Hello I have next function, what always return null as result, but service calling to success branch with any error,
I would like to fix it: 1. Remove async attribute, 2. Other function that make GetStore function call should process result of this function. How I can do this in correct way ? ()
Thanks.
function GetStore() {
$.ajax({
url: serviceurl + 'GetSometing',
type: 'POST',
contentType: 'application/json',
dataType: "json",
async: false,
success: function (result) {
return result;
},
error: function (xhr, description, error) {
return null;
}
});
}
If you want to make it asynchronous you can’t wait for it to return a value, you have to implement callback functions.