xmlhttprequest tutorial code example

Example 1: javascript howto get xhr

function httpGet(theUrl)
{
    var xmlHttp = new XMLHttpRequest();
    xmlHttp.open( "GET", theUrl, false ); // false for synchronous request
    xmlHttp.send( null );
    return xmlHttp.responseText;
}

Example 2: xmlhttprequest

XMLHttpRequest. XMLHttpRequest is a built-in browser object that allows to make HTTP requests in JavaScript. Despite of having the word “XMLin its name, it can operate on any data, not only in XML format. We can upload/download files, track progress and much more.