shortysbest Posted July 12, 2010 Share Posted July 12, 2010 I am building a website and it has a few notification areas that i am using ajax to automatically update on a set time, so far i have two functions that need to load onpage load, if i just have one function one works, but if i put the other that works, they wont work together though. So i was wondering why this might be? <body onload="getEmail();getNotifications()"> /////////////////EMAIL NOTIFICATIONS///////////////// //auto retrieve new emails function getEmail() { new Ajax.PeriodicalUpdater('email-notifier', 'php/notifications/get_emails.php', { method: 'get', frequency: 1, decay: 1 }); setTimout("getEmail()", 6000); } ////////////////NOTIFICATIONS/////////////// //friend requests function getNotifications() { new Ajax.PeriodicalUpdater('notifications', 'php/notifications/get_notifications.php', { method: 'get', frequency: 1, decay: 1 }); setTimout("getNotifications()", 6000); } Quote Link to comment Share on other sites More sharing options...
XeNoMoRpH1030 Posted July 12, 2010 Share Posted July 12, 2010 A quick search shows you are using Prototype, but your logic is wrong. If you ever wanted to stop it, you'd want to assign that to a global variable. If not, just the following would work new Ajax.PeriodicalUpdater('email-notifier', 'php/notifications/get_emails.php', { method: 'get', frequency: 1, decay: 1 }); without the functions and javascript timeout. Quote Link to comment Share on other sites More sharing options...
shortysbest Posted July 12, 2010 Author Share Posted July 12, 2010 thanks, but that isn't working :| 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.