|
First... AJAX is a methodology, not a language. The language is JavaScript. The whole process looks like this.
|
|
CREATED 2012-09-04 19:12:24.0
|
00-16-79
|
UPDATED 2012-09-04 19:12:36.0
|
|
|
|
As the request is processed the ready states change. The current state can be found in the readyState property...
- 1 - is when the request object is created.
- 2 - means the request object has been sent
- 3 - the request object is comming back but not all back
- 4 - the response is received.
The response property is null until the ready state is set to 4. You will get a null object and a statusCode of undefined.
|
|
CREATED 2020-08-18 06:40:07.0
|
010-00-02-78
|
UPDATED 2020-08-18 09:11:57.0
|
|
|
|
- OnReadyStateChange - Executes when the state changes (see states). This is usually a function.
- readyState - the current state (see states)
- response - what the server said.
- responseText - the response in text form (null until readyState is 4)
- responseType - the type of response (null until readyState is 4)
- responseURL - the url the response came from
- responseXML - the response as an XML document (null until readyState is 4)
- status - HTTP status code received from the server e.g. 200 or 404
- statusText - HTTP status code description from the server e.g. OK or NOT FOUND
- timeout - how long to wait for the response before giving up
- upload - an upload object (XMLHttpRequestUpload)
- withCredentials - a boolean that indicates if cross site access control request should be made with cred
|
|
CREATED 2020-08-18 06:54:04.0
|
010-00-02-82
|
UPDATED 2020-08-18 09:04:22.0
|
|
|
|
These are the methods of the request.
- abort()
- getAllResponseHeaders()
- getResponseHeader(String name)
- open(String [method], String [url[, async[, username[, password]]]])
- overrideMimeType(String mimeType)
- send(String body)
- setRequestHeader(String name, String value)
|
|
CREATED 2020-08-18 08:52:39.0
|
010-00-02-83
|
UPDATED 2020-08-18 09:04:23.0
|
|
|
|
req.onError = function(){ alert(An error just happend ) }
These are the Events of the request.
- abort - abort method was called
- error - an error occurs
- load - request completes successfully
- loadEnd - request completes regardless of status
- loadStart - request starts to load data
- progress - request recieves more data
- timeout - the timeout property has been exceeded
Events can be loaded by using the addEventListener(eventName) method OR by loading a call back in the on[eventName] property.
|
|
CREATED 2020-08-18 09:00:13.0
|
010-00-02-84
|
UPDATED 2020-08-18 09:04:24.0
|
|
|