function blockingGet1(url) { return $.ajax({ url: url, async: false }).responseText; } function blockingGet2(strUrl) { var strReturn = ''; $.ajax({ url:strUrl, success: function(html){strReturn = html;}, async:false }); return strReturn; } function exampleUse() { var stuff = blockingGet1('/data.txt'); alert(stuff); }
Programming Tips - jQuery: do a blocking AJAX get
Date: 2011sep18
Library: jQuery
Language: javaScript
Keywords: synchronous
Q. jQuery: do a blocking AJAX get
A. Here are two functions that do just that: