JQuery Ajax 500 (Internal Server Error)
I am using jquery library to make an ajax call in a php file. Everything worked fine when the path was relatively like this:
url:"fetch_term_grades.php",
But when I change the path like this:
url:"includes/ajax/fetch_term_grades.php",
I am getting this error from the console:
jquery-2.2.3.min.js:4 POST http://localhost/SchoolMate/includes/ajax/fetch_term_grades.php 500 (Internal Server Error)
This is my ajax code:
$.ajax({
url:"includes/ajax/fetch_term_grades.php",
method:"post",
data:{"term":term},
dataType:"text",
success:function(data){
$("#result").html(data);
$('#dataTable').DataTable();
//$('table').attr('id', 'dataTable');
}
});
+3
source to share
2 answers
It depends on where you are calling this script from. In your case, the file that calls the scripts is in the same folder that includes / ajax / fetch_term_grades.php. If you want to call it using this url includes / ajax / fetch_term_grades.php you have to put two layers up, that is: it has to be next to the include folder.
0
source to share