Return ajax without using async: false
Hello, I'm trying to create a function that returns the result of an ajax request, but the ajax is asynchronous. Someone could tell me how to do it. example:
function ajax(){
$.ajax({
url: link,
data: data,
dataType: 'json',
success: function (result) {
return result;
}
}
});
}
var result = ajax();