Latest web development tutorials

XMLHttpRequest Object

XMLHttpRequest Object

XMLHttpRequest object is used to exchange data with the server in the background.

XMLHttpRequest object is adeveloper's dream, because you can:

  • Update web page without reloading the page
  • After the page is loaded from the server request data
  • After the page has loaded data received from the server
  • Sending data to the server in the background

To learn more about the XMLHttpRequest object knowledge, study our XML DOM tutorial .

XMLHttpRequest instances

When you type a character in the input field below, a XMLHttpRequest sent to the server - Returns the name of recommendations (from the file on the server):

Type a letter in the input box:



Create an XMLHttpRequest object

All modern browsers (IE7 +, Firefox, Chrome, Safari and Opera) have built-in XMLHttpRequest object.

Create XMLHttpRequest object syntax:

xmlhttp=new XMLHttpRequest();

Older versions of Internet Explorer (IE5 and IE6) using ActiveX objects:

xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");

In the next chapter, we will use the XMLHttpRequest object to retrieve XML information from the server.