Ideas for trasfering data from php to js

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
fishown
Forum Commoner
Posts: 33
Joined: Sat May 12, 2007 5:35 pm

Ideas for trasfering data from php to js

Post by fishown »

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.
User avatar
Technocrat
Forum Contributor
Posts: 127
Joined: Thu Oct 20, 2005 7:01 pm

Re: Ideas for trasfering data from php to js

Post by Technocrat »

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

Post by Blackshawk »

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
Post Reply