I was trying to create a simple AJAX request which returns some data from a database. My function is mentioned below:
function AJAXrequest(url, postedData, callback) {
$.ajax({
type: 'POST',
url: url,
data: postedData,
dataType: 'json',
success: callback
});
}
Here's where I call it, providing the required parameters:
AJAXrequest('voting.ajax.php', imageData, function(data) {
// function body
});
Yet, the callback does not run, and instead I get an error in the console:
TypeError: $.ajax(...) is not a function.
I want to know the reason why and how do I go about this?