Setup:
I am doing an ajax-jsonp call, which is working fine. The callback function of this changes value of a variable, \"myVaraible\". Just after the c
From the $.ajax documentation:
Cross-domain requests and dataType: "jsonp" requests do not support synchronous operation
So, you'll need to put anything that relies on the results of the request in the callback.
I believe there's no reason you cannot do
function myfunction() {
return $.ajax({
url: myURL,
dataType: "jsonp",
jsonp : "jsonp",
jsonpCallback: "jsonpCallbackFn"
});
}
and then
...
$("#preview_button").mouseover(function() {
myfunction().done(function(){
alert("after myfunction");
});
});
jQuery appears to do a bunch of magic behind the scenes to normalize jsonp requests to act somewhat like jquery ajax requests, so I think this is fine. Let me know otherwise.