I am trying to return a value from an Ajax call but am unable to find the correct way to do this. Here is what I have now:
function getCount() {
$.ajax({
url: "php/get.php",
type: 'get',
dataType: 'html',
data: { location: "", category: "10" },
async: false,
success: function(data) {
result = Math.ceil(data/20);
}
});
return result;
}
As you can see, I used async false that is now depreciated. Is there another way yo return this from the function like I am now without using async: false
?