dianikol85 Posted November 23, 2010 Report Share Posted November 23, 2010 Hi to all!! Here is my questiion: i have this code <script type="text/javascript"> $(document).ready(function(){ get_current_song(); setInterval("get_current_song()",5000); }); function get_current_song(){ $('#reload_now_play').load("load_song.php"); } </script> to load some text from another script .The content of load_song.php where i get the text, changes every 3-4 minutes. So i use the get_current_song() function every 5 secs by using the setInterval function. That works for this project but i think if the server for example get down for a while the above technique will return an empty string. So i guess i have to use the $().load() function again after it comlete over and over and this will solve the bad timing problem. How should i write it?? Thanks. Quote Link to comment Share on other sites More sharing options...
falkencreative Posted November 23, 2010 Report Share Posted November 23, 2010 That works for this project but i think if the server for example get down for a while the above technique will return an empty string. Technically, if the server is down, your users won't be able to access your site, including this script... Unless the Javascript you posted above and the "load_song.php" file will be on different domains/servers? Quote Link to comment Share on other sites More sharing options...
dianikol85 Posted November 23, 2010 Author Report Share Posted November 23, 2010 Technically, if the server is down, your users won't be able to access your site, including this script... Unless the Javascript you posted above and the "load_song.php" file will be on different domains/servers? The server example was a bad one. What i meant is if the response is lets say faster than the setinterval call Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.