O'Reilly logo

Programming Atlas by Christian Wenz

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix A. XMLHttpRequest Reference

This Appendix assembles all methods and properties that the XMLHttpRequest object exposes. Square brackets [] denote an array; parentheses () indicate a method.

To create an XMLHttpRequest object for Internet Explorer, you must use ActiveX:

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

With other browsers, the XMLHttpRequest object is a built-in type and can be instantiated directly, as in the following snippet:

XMLHTTP = new XMLHttpRequest();

Once the XMLHttpRequest object is instantiated, the following cross-browser methods and properties are supported:.

Methods

Method

Description

abort()

Aborts the request

getAllResponseHeaders()

Returns all headers of the HTTP response

getResponseHeader(header)

Returns the value of the given HTTP response header

open(method, url, async, username, password)

Creates an HTTP request with the given method (GET or POST) to the given URL. The other parameters are optional: whether to use an asynchronous call (default) or not, and credentials for HTTP Authentication

send(content)

Sends the HTTP request, optionally providing data to send with it (POST information)

setRequestHeader(name, value)

Adds a header with the given name and value to the HTTP request

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required