The data required for Ajax is not available yet.
During the application of the new brushless DC technology, two functions are often used to connect to the server. The former is called the callserver () function, and the latter is called the updatepage () function;
VaR response = XMLHTTP. responsetext;
Control ID. innerhtml = response;
The above is incorrect syntax. The correct syntax is as follows;
If (XMLHTTP. readystate <4)
{
Control ID. innerhtml = "reading data... ";
}
If (XMLHTTP. readystate = 4)
{
VaR response = XMLHTTP. responsetext;
Control ID. innerhtml = response;
}
Readystate indicates the processing status of the XMLHTTPRequest object: 0: the XMLHTTPRequest object has not been initialized yet. 1: the XMLHTTPRequest object starts sending requests. 2: The request of the XMLHTTPRequest object is sent completely. 3: the XMLHTTPRequest object starts to read the server's response. 4: the XMLHTTPRequest object reads the server and the response ends.