Using ajax+php to create a progress bar is actually very simple.
ReadyState = = Status (0,1,2,3,4)
0: The request was not initialized and the open was not called
1: The request has been established, but has not yet been sent, and the send has not been called
2: The request has been sent and is being processed
3: The request is being processed, and a portion of the data in the response is usually callable
4: Complete
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 is an asynchronous transfer
Xmlhttp.onreadystatechange = ip985;//response function
Xmlhttp.send (NULL);
}
function ip985 ()
{
if (xmlhttp.readystate==1)
{
document.getElementById (' IP985 '). InnerHTML = "Request established, ready to send ..."; IP985 flag bit
}
if (xmlhttp.readystate==4)
{
var v = xmlhttp.responsetext;//Get content
document.getElementById (' ip985 '). InnerHTML = v;//target page content
}
}
Source: 5D Happy blog: http://www.5DKX.com/
http://www.bkjia.com/PHPjc/364548.html www.bkjia.com true http://www.bkjia.com/PHPjc/364548.html techarticle using ajax+php to create a progress bar is actually very simple. ReadyState = = Status (0,1,2,3,4) 0: Request not initialized, open 1 not yet called: the request has been established, but has not yet been sent, not yet called send ...