Prev | Current Page 507 | Next

Emilian Balanescu and Cristian Darie

"Beginning PHP and MySQL E-Commerce: From Novice to Professional, Second Edition"

)
CHAPTER 13 ?–  IMPLEMENTING AJAX FEATURES 404
Using XMLHttpRequest
Once the XMLHttpRequest object has been created, you can start using it to initiate synchronous
or asynchronous server requests. Table 13-1 describes the public methods and properties of
this object.
Table 13-1. The XMLHttpRequest API
Method/Property Description
abort Stops the current request
getAllResponseHeaders() Returns the response headers as a string
getResponseHeader("headerLabel") Returns a single response header as a string
open("method", "URL"[, asyncFlag[, Initializes the request parameters
"userName"[, "password"]]])
send(content) Performs the HTTP request
setRequestHeader("label", "value") Sets an HTTP request header
onreadystatechange Sets the callback function that handles request state
changes
readyState Returns the status of the request:
0 = uninitialized
1 = loading
2 = loaded
3 = interactive
4 = complete
responseText Returns the server response as a string
responseXml Returns the server response as an XML document that
can be manipulated using JavaScript??™s DOM functions
status Returns the status code of the request
statusText Returns the status message of the request
The methods you will use with every server request are open() and send(). The open()
method configures the request without sending it. It has two required parameters and a few
optional ones.


Pages:
495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519
strony Pozycjonowanie konta oszczędnościowe włosy Gallery of Bialowieza