(extends Object)
Object Summary
A stub that is used to create a cross-browser AJAX interface.
Constructor
Methods
comments
Removes all field-value pairs.
XHRequest.addField(strField,strValue)
parameters
strField - field.
strValue - corresponding value.
comments
Adds a new field-value pair to be posted.
parameters
strURL - The URL to post the AJAX request.
comments
Asynchronously posts the AJAX request.
XHRequest.postSynchronized(strURL)
parameters
strURL - The URL to post the AJAX request.
comments
Synchronously posts the AJAX request. Script execution stops and continues after the server's response reaches client.
The difference between post and postSynchronized methods is that the latter waits for the request to complete and then program execution continues, while the former executes as a separate thread.
Note that, synchonized posts are generally not recommended because they may create a frozen GUI feeling on the client side.
parameters
strURL - The URL to send the request. Note that usual cross-frame security issues apply to this url as well.
comments
Creates an asynchronous HTTP_GET request to strURL.
XHRequest.getSynchronized(strURL)
parameters
strURL - The URL to send the request. Note that usual cross-frame security issues apply to this url as well.
comments
Creates an synchronized HTTP_GET request to strURL.
The difference between get and getSynchronized methods is that the latter waits for the request to complete and then program execution continues, while the former executes as a separate thread.
Note that, synchonized posts are generally not recommended because they may create a frozen GUI feeling on the client side.
returns
comments
Returns the internally stored XMLHttpRequest object. If there is no stored XHR object creates one and returns it. Otherwise returns the existing XHR object.
comments
Cleans up memory and deallocates all consumed resources.
This method is implicitly called when either abort method is called or AJAX response completes normally (which automagically triggers oncomplete).
comments
Initializes the object.
This method is implicity called by the constructor, thus you don't need to call it at construction phase.
However, if you want to post another AJAX request after one has completed, you need to re-initialize the object with init method.
comments
Aborts the current request and releases the resources used.
XHRequest.oncomplete(strResponseText,strResponseXML)
parameters
strResponseText - The response text.
strResponseXML - The response XML.
comments
This method MUST be overridden.
The method is called by the object whenever the request completes.
See the test case for an example usage.
XHRequest.onerror(intStatus,strStatusText)
parameters
intStatus - The status code.
strStatusText - The error message.
comments
This method MUST be overridden.
The method is called by the object whenever an error occurs and the request does not complete successfully.
An error is raised if the HTTP_STATUS_CODE is not 400 (completed) or 304 (retrieved from cache).
See Also
None given.
Usage Examples
Comments (0)
You don't have permission to comment on this page.