I need to create an ajax processing file, where this javascript is to send the variable myGroupId to, then send it back to my edit.php file where I can then run a query off of the returned file.
I am not experienced with ajax, so I need to know how the processing file should look regarding the javascript variable being converted to a php variable. I know I need to create another folder to send the javascript variable.
I just need to know how to do the ajax processing file (or whatever you want to call it).
Here is my javascript:
<script type="application/javascript">
$(document).on("click", ".open-EditRow", function () {
var myGroupId = $(this).data('id');
$(".modal-body #groupId").val( myGroupId );
// ajax call
var url = "?groupId=" + encodeURIComponent(myGroupId);
$.get(url, function(data){
// do something here
});
});
</script>
I'll call the separate file ajaxProcessing.php. Now if someone could show me how that file should look to convert myGroupId to a php variable, I would be grateful.
When it is sent back to my edit.php file, I should be able to reference it as $_GET['groupId'].
Thank you in advance.