Date: 2011sep18
Product: jQuery
Language: javaScript
Q. How can do I a blocking GET with jQuery?
A. Here are two functions that do just that:
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);
}
| What this info useful to you? You can donate to say thanks |
Add a comment
Sign in to add a comment