jQuery: "async: false" with "beforeSend"
Hi All,
The following code works good in Firefox, and displays the "Loading" image till there's a response. But the same does not show the "Loading" image in other browsers (IE, Safari).
I found somewhere that having both
async: false
and
beforeSend
doesn't go hand-in-hand. According to http://api.jquery.com/jQuery.ajax/#options : Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active.
Is there any workaround? Please advise.
var resp = $.ajax({ url: myUrl, async: false, beforeSend: function () { jQuery('loading').show(); }, success: function(data, result) { jQuery('loading').hide(); }}).responseText;
Thanks!