I’m trying to make a progress bar so I used APC apache extension to make this: http://pastebin.com/TBui6ckT
I used: header("Percent:".$percent); to give the percent as a header when you call the site. So I went back to the index page a used ajax to call that progress page and check the header that I made called “Percent” and change something on the main page to that number. Heres the script for that: http://pastebin.com/NkQv2Uq0 the var test; is just temporary, I will change it to:
if(xmlhttp.getResponseHeader("Percent")<=100) ...
I’m thinking it’s the the header just returning “Header: ‘percent’%” as a string … but I’m not sure. Also I know for a fact it’s the header because if I put in: document.getElementById('progress_number').innerHTML=xmlhttp.getAllResponseHeaders(); It returns every header including the Percent. But oddly it does not update it’s self. You would think that it would loop with: setTimeout(onSubmit(upload_id), 999); but it does not.
Thanks for the help.
In your second pastebin you have a bug
it should be
The second bug you have is your setTimeout is wrong
should be
Thirdly
getResponseHeaderreturns a string so you are comparing a string to a number. You would need to useparseInt()