This is my $.ajax function. volunteerDist is an array in a previous function and it calls myAjax(volunteerDis);However, the program always calls the error and complete functions, with an error message of undefined. What should I do? Thanks
admin-view-available-volunteeers.php is the filename where this is located
volunteerDist is an array that contains floats
function myAjax(volunteerDist){
$.ajax({
type:'POST',
url: 'admin-view-available-volunteeers.php',
data : ({
distance:volunteerDist
}),
success: function(){
alert('worked');
},
error :function(err){
alert('nope :( ERROR: ' + err.ErrorMessage);
},
complete : function(){
alert('thanks');
}
});
}
To get better debugging on error you need to update your code, this
will not work – as
erris ajqXHRobject!change it to this :
This will output the message sent by the server.
All the details for the params of
.ajax()are documentation hereUpdate
Check the name of your PHP file …
has 3
es in the wordvolunteer… is this the problem ?