Using Ajax+php to create a progress bar is actually very simple.
readyState == status (0,1,2,3,4)
0: The request has not been initialized and open has not been called yet
1: The request has been established, but has not been sent yet, and send has not been called yet
2: The request has been sent and is being processed
3: The request is being processed, usually some data in the response can be called
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 browsers
}
}
function Request(url)
{
xmlHttp.open("GET","for.php?id="+url,true);//true is asynchronous transmission
xmlHttp.onreadystatechange = ip985;//Response function
xmlHttp.send(null);
}
function ip985()
{
if(xmlHttp.readyState==1)
{
document.getElementById('IP985').innerHTML = "The request has been established and is ready to be sent..."; //IP985 flag
}
if(xmlHttp.readyState==4)
{
var v = xmlHttp.responseText;//Get content
document.getElementById('ip985').innerHTML = v;//Target web page content
}
}
Source: 5D Happy Blog: http://www.5DKX.com/