Synchronous HTTP GET in JavaScript

Taking the “A” out of “AJAX.”

 function get(url) {
  var ajax = new XMLHttpRequest();
  ajax.open('GET', url, false);
  ajax.send(null);
  return ajax.responseText;
}

Of course this will be different for IE….

Posted in | | Leave a response

Leave a Reply