Ajax + php creates the readyState status of the progress bar. Creating a progress bar with Ajax + php is actually very simple. ReadyState status (, 4) 0: The request has not been initialized, open1 has not been called: The request has been created, but has not been sent, and send has not been called to create a progress bar using Ajax + php, it is actually very simple.
ReadyState = status (0, 1, 2, 3, 4)
0: The request has not been initialized and open has not been called.
1: The request has been created, but has not been sent yet.
2: The request has been sent and is being processed
3: The request is being processed. generally, some data in the response can be called.
4: Finished
The code is as follows:
Var xmlHttp;
Function create ()
If (window. ActiveXObject)
{
XmlHttp = new ActiveXObject ("Microsoft. XMLHTTP"); // IE browser
}
Else if (window. XMLHttpRequest)
{
XmlHttp = new XMLHttpRequest (); // non-IE browser
}
}
Function Request (url)
{
XmlHttp. open ("GET", "for. php? Id = "+ url, true); // true indicates asynchronous transmission.
XmlHttp. onreadystatechange = ip985; // response function
XmlHttp. send (null );
}
Function ip985 ()
{
If (xmlHttp. readyState = 1)
{
Document. getElementById ('ip985'). innerHTML = "The request has been created and is ready to be sent ...... "; // IP985 flag
}
If (xmlHttp. readyState = 4)
{
Var v = xmlHttp. responseText; // get the content
Document. getElementById ('ip985'). innerHTML = v; // target webpage content
}
}
Bytes. ReadyState = status (0, 1, 2, 3, 4) 0: The request has not been initialized and open 1 has not been called. the request has been created, but has not been sent. the send...