In XMLHttpRequest, where is the error flag variable?

The specification XMLHttpRequest states that:

The DONE state has an associated error flag indicating some type of network error or abortion. It can be either true or false, and has an initial value of false.

Also says something similar about the "send ()" flag in the "OPEN" state.

He said in the specification, but not in the IDL, and when I create a new XMLHttpRequest, I can not find these "flags".

Where are these boolean variables?

+5
source share
3 answers

I webapps , :

, , -IDL. .

( )

+3

XMLHttpRequest.readyState - , .

Spec, , "" .

  • UNSENT ( 0)
  • ( 1)
  • HEADERS_RECEIVED ( 2)
  • ( 3)
  • ( 4)

XMLHttpRequest.onreadystatechange. , , - .

//In Javascript
var request = new XMLHttpRequest();
if (request) {
  request.onreadystatechange = function() { 
    if (request.readyState == 4) { //Numeric 4 means DONE

        }
   };

request.open("GET", URL + variables, true); //(true means asynchronous call, false otherwise)
request.send(""); //The function that executes sends your request to server using the XMLHttpRequest.
}

, onreadystatechange , XMLHttpRequest.send() ( ). , XMLHttpRequest.onreadystatechange , .

Wikipedia

+5

, XHR , , , , .

"send()".

+4

All Articles