What I’m to figure out how to do is execute a web service on a remote server to determine how many messages there are available to read and populate the text of a hyperlink with the message count. The trick is I’d like this to be fired from a timer (every 5 mins for example). Here’s what I’ve been messing with
$.ajax( {type:'Get',url:'http://example.com/ws',success:function(messageCount)
{
$('a.message').text(messageCount + ' Messages');
}
})
but admittedly, I am utterly clueless when it comes to timers in Javascript/jQuery. Any help would be greatly appreciated.
You need to use the setInterval() function. This will run a defined function at the specified interval. Try this: