Hello every one,
Program Backgound:
My program is basicly download huge files from anouther server over HTTP/FTP protocols,
As you can imagen this this action take some time, So I decide to add progress bar to this action.
So what I did so far (that by the way pritty lame):
Index.php - recive the address and has button to start or to reset the fields,
action.js - On click, get the address from the index and start "Progress.php" and read session file "info.php"
Progress.php - download the file using cURL and put the "percent" into session (that as i alredy mationd will be read by "action.js"
This mathod is pritty lame and week...
I Just want you peoeple to drop a new ideas that i could start from.
Thanks alot.
Ideas for trasfering data from php to js
Moderator: General Moderators
- Technocrat
- Forum Contributor
- Posts: 127
- Joined: Thu Oct 20, 2005 7:01 pm
Re: Ideas for trasfering data from php to js
Best bet would probably be with AJAX. Jquery has a pretty easy to understand and use library for AJAX and timed events. Just make an ajax file that simply gets the % from the session and passes back to your JS. Then update to the screen.
-
Blackshawk
- Forum Newbie
- Posts: 5
- Joined: Thu Feb 10, 2011 8:16 am
Re: Ideas for trasfering data from php to js
Either that or you could look into doing it with an iframe (aka: Comet style). This is similar to Ajax, except that you don't have to continuously poll the server.
http://www.zeitoun.net/articles/comet_and_php/start
http://www.zeitoun.net/articles/comet_and_php/start