I've done some jQuery in the past, but I am completely stuck on this. I know about the pros and cons of using synchronous ajax calls, but here it will be required.
The remote page is loaded (controlled with firebug), but no return is shown.
What should I do different to make my function to return properly?
function getRemote() {
var remote;
$.ajax({
type: "GET",
url: remote_url,
async: false,
success : function(data) {
remote = data;
}
});
return remote;
}
seems that the statement "[synchronous] will be required" indicates a lack of understanding of JavaScript engines, thus a poorly architected app.
Or a very good understanding: If you want to do an AJAX callonbeforeunload
, using a synchronous request is actually the recommended way (as the browser window would be gone before the request returned otherwise). In any way he clearly says ` I know about the pros and cons of using synchronous ajax calls`... Maybe just believe him?