This code stops mousemove event
$.ajaxSetup({async:false});
$.get(url).success(function(data) { result = data; });
Is there a way to avoid this but keep $.ajaxSetup({async:false});, like a load function?
Thanks
Additions:
what if I need
$.ajaxSetup({async:false});
$.get(url).success(function(data) { result = data; });
$.ajaxSetup({async:true});
return result
how to handle that?
Thanks
returnimplies synchronous code flow. AJAX is asynchronous withoutasync: false, however. This does not mean you should useasync: false. Rather, you should change your code flow to use callbacks instead of return values.This is needed since there is no way to make the asynchronous code synchronous (i.e. you can’t use
returnwith asynchronous functions). The only way is to provide a callback yourself as well:Like: