How is the right way to get page content each second?
I have one page which got a music player (using flash player) and other that generates the name of the song(php file). I have set the php file to ECHO only the name, so the only thing is to get that echo and put it at main page where is the player. But it must refresh each second(or 2-3max) because the songs are changing and so are the names.
I hope you can understand my need , ask me for other details if you need.
How is the right way to get page content each second? I have one
Share
I wouldnt advise using setInterval with an AJAX request, as if an ajax request is taking a long time to respond, then it will still keep sending subsequent requests. Instead I would have a complete callback which triggered the next setTimeout, e.g: