student_id
having a value of 0001. It shows the error
"Uncaught ReferenceError: studentId is not defined"
$.ajax({
url: "student_info.php",
method: "post",
data: {
studentId: student_id
},
success: function (data, status) {
console.log(studentId);
},
});
console.log
should display the value of ‘0001’.
2
Answers
it’s because studentId passed as json key to student_info.php if you want get student id you can use student_id
Look at your code
studentId isnt a variable it should be something akin to
studentId is contained in your data object. That being said it would be good to show the full code and also log the data and status, that way the question is more reproduce-able and we ensure there are no other issues