window.xmlhttprequest javascript code example

Example 1: xmlhttprequest javascript

function reqListener () {
  console.log(this.responseText);
}

var oReq = new XMLHttpRequest();
oReq.onload = reqListener;
oReq.open("GET", "http://www.example.org/example.txt");
oReq.send();

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.