I'm attempting to create an AJAX request. Here's my function definition:
function AJAXrequest(url, postedData, callback) {
$.ajax({
type: 'POST',
url: url,
data: postedData,
dataType: 'json',
success: callback
});
}
Here's where I call it, providing the parameters:
AJAXrequest('voting.ajax.php', data, function(data) {
// function body
});
Yet the callback does not run, and instead I get a console.error:
TypeError: $.ajax(...) is not a function.
Why?

$.ajaxwithout arguments ($.ajax()) and the return value is a jqXHR object, which is not a function. Hence$.ajax()(...)will throw an error.