Need Help With Joomla And RS Forms

Job ID: 36627521

Budget: $10 – $30 USD

trying to utilize jquery and modal forms and joomla and rs forms with php/html ->. This is what I have

Uncaught TypeError: Cannot read properties of undefined (reading 'id')

this line throws the error
$('#validateVisit').on('show.bs.modal', function (e) {
document.getElementById('id').innerHTML = e.relatedTarget.id;
});

And this is my code
async function visitModification(id, type) {
let title = null;
if (type == "manager") { title = "Input Data For Manager Validation"; }
if (type == "employee") { title = "Input Data For Employee Validation"; }
jQuery.ajax({
type: "GET",
url: "index.php?option=com_ajax&plugin=ValidationData&format=raw&id=" + id + "&type=" + type,
success: function(data) {
jQuery('#validationModal .modal-body p').html(data);
jQuery("#editModalTitle").html(title);
jQuery('#validationMOdal').modal('show');
},
error(xhr, status, error) { alert("There is a problem in server, please try later"); }
});
}


<div id="validationModal" class="modal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 id="editModalTitle" class="modal-title">h</h4>
<div class="modal-body">
<p>Form</p>
</div>
<div class="modal-footer"><button id="validateModalSave" class="btn btn-primary" type="button">Save</button></div>
</div>
</div>
</div>
</div>

However, thro the debugging I can do I have confirmed that the error is thrown when the code reaches the JQuery inside the success: function(data) { bc if I comment out the 3 lines there no error is displayed (but of course the modal I want to dispaly isn't displayed either).

What do I need to do to resolve this?
Related categories: PHP Bootstrap jQuery