Visit Mozilla.org

nsIJSXMLHttpRequest

From MDC


The nsIJSXMLHttpRequest interface describes event listeners for the XMLHttpRequest class. This allows applications to monitor an HTTP request for progress updates, errors, and the completion of the load process while loading an HTTP document asynchronously.

Contents

nsIJSXMLHttpRequest is defined in content/base/public/nsIXMLHttpRequest.idl. It is scriptable and unfrozen (hasn't changed since Mozilla 1.8.1).

Inherits from: nsISupports

Warning: This interface must only be used from JavaScript code, rather than from native code.

[edit] Attributes

Attribute Type Description
onload nsIDOMEventListener Called when the HTTP document has been completely loaded. The event sent to the receiver has its target attribute set to the XMLHttpRequest that finished loading.
onerror nsIDOMEventListener Called when an error occurs while attempting to retrieve the HTTP document. Check the status attribute of the XMLHttpRequest specified by the target attribute in order to determine which HTTP error occurred.
onprogress nsIDOMEventListener Called periodically while the document is being loaded. The event sent to the receiver has a position attribute indicating how far through the document the process is, as well as a totalSize attribute indicating the total size of the document. In addition, it has its target attribute set to the XMLHttpRequest corresponding to the progress notification.
onreadystatechange nsIDOMEventListener Called when the readyState changes. What does this mean?

[edit] Remarks

You must call open() on the XMLHttpRequest before setting any event listeners on it.

[edit] See also