Ajax uses callbacks, as it\'s A
synchronous.
I want my call to the remote URL block until there\'s some answer, exactly as in Ajax, but
You can simply set the async : false
boolean when using jQuery (check the docs). Take note: As of jQuery 1.8, the use of async: false with jqXHR ($.Deferred) is deprecated; you must use the complete/success/error callbacks.
If you don't want to use jQuery or want to know what's going on under the hood, read this.
xmlhttp.open("GET","ajax_info.txt",false);
xmlhttp.send();
document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
Do wonder why you don't want it to be async though...