xmlhttprequest
Voir https://xhr.spec.whatwg.org/
readyState
UNSENT | 0 | The object has been constructed. |
---|---|---|
OPENED | 1 | The open() method has been successfully invoked. During this state request headers can be set using setRequestHeader() and the request can be made using the send() method. |
HEADERS_RECEIVED | 2 | All redirects (if any) have been followed and all HTTP headers of the final response have been received. Several response members of the object are now available. |
LOADING | 3 | The response entity body is being received. |
DONE | 4 | The data transfer has been completed or something went wrong during the transfer (e.g. infinite redirects). |
Status
- If the state is UNSENT or OPENED, return 0. - If the error flag is set, return 0. - Return the HTTP status code.
Events
note : ajouter on devant chaque nom d'event pour usage, ex pour readystatechange :
xhr.onreadystatechange = function() { // blablabla };
(xhr étant un objet XMLHttpRequest)
Event name | Interface | Dispatched when… |
---|---|---|
readystatechange | Event | The readyState attribute changes value, except when it changes to UNSENT. |
loadstart | ProgressEvent | The request starts. |
progress | ProgressEvent | Transmitting data. |
abort | ProgressEvent | The request has been aborted. For instance, by invoking the abort() method. |
error | ProgressEvent | The request has failed. |
load | ProgressEvent | The request has successfully completed. |
timeout | ProgressEvent | The author specified timeout has passed before the request completed. |
loadend | ProgressEvent | The request has completed (either in success or failure). |
xmlhttprequest.txt · Last modified: 2015/10/06 18:16 by 95.211.60.11