Wednesday, February 9, 2011

The XMLHttpRequest object


Allows to interact with the servers, thanks to its methods and attributes.

Attributes
readyStatethe code successively changes value from 0 to 4 that means for "ready".
status200 is OK
404 if the page is not found.
responseTextholds loaded data as a string of characters.
responseXmlholds an XML loaded file, DOM's method allows to extract data.
onreadystatechangeproperty that takes a function as value that is invoked when the readystatechange event is dispatched.
Methods
open(mode, url, boolean)mode: type of request, GET or POST
url: the location of the file, with a path.
boolean: true (asynchronous) / false (synchronous).
optionally, a login and a password may be added to arguments.
send("string")null for a GET command.

No comments:

Post a Comment