I need to poll a webservice once an hour to check for new messages. I want to do it with jQuery. The ajax call would be like this:
function checkForMessages(rowid) {
$.ajax({
type: "POST",
url: "MyPage.aspx/CheckForMessages",
contentType: "application/json; charset=utf-8",
data: "{'currentMessages': '" + cMessages+ "'}",
dataType: "json",
success: function (msg) {
},
error: function (response) {
}
});
}
url: "MyPage.aspx/CheckForMessages"
is actually a PageMethod instead of Webservice.
What I don't understand is how to make the "loop" with jquery that waits an hour to call the above function.
So how can I make the code that calls this function only once an hour?