Core JavaScript

AJAX reference

The term AJAX stands for Asynchronous JavaScript and XML and was coined in 2005 by Jesse James Garrett. AJAX is a technique for using the browser's

XMLHttpRequest object to transfer data between the client and the server without causing the page to refresh.

The original XMLHttpRequest object was added as an ActiveX object into Microsoft's Internet Explorer 5 browser in 1999. Afterward, other browsers followed Microsoft's lead with their own implementations of XMLHttpRequest that did not require ActiveX.

XMLHttpRequest


 
PropertiesDescription
onreadystatechangeThis is set to an event handler function that is called whenever the readyState property changes.
readyStateThis an integer value that indicates the status of the request:
  • 0 = Uninitialized
  • 1 = Loading
  • 2 = Loaded
  • 3 = Interactive
  • 4 = Complete
responseTextText data that is returned from the server.
responseXMLXML data that is returned from the server.
statusThis is the HTTP status code returned by the server.
statusTextThis is the HTTP text code returned by the server.
 

 
MethodsDescription
abort()Call to abort the current request.
getAllResponseHeaders()Return all of the headers in a string.
getResponseHeader(name)Return the value of name as a string.
open(type, url, asynch)Open requests a file download. The type is the type of the request, usually GET or POST, but may be any of the following:
  • GET
  • POST
  • HEAD
  • PUT
  • DELETE
  • OPTIONS
The url is the location of the file, with possible parameters tacked on. The parameter asynch is a boolean value that is true if the request is asynchronous.
send(data)This sends the HTTP request to the server. The data is data that is sent to the server.
setRequestHeader(name, value)This puts the (name, value) pair in header of the HTTP request.
 

 
 

© 2007–2024 XoaX.net LLC. All rights reserved.