is there a better way to use jquery and php to help check for messages like inbox etc. i know i can use the ajax with set interval to check for a particular php file giving me the messages
something like this with set interval
$.ajax({
url: "message.php",
type: "POST",
data: { time : time_stamp },
dataType: "json",
success: function(data) {
// update the div content from here
}
}
});
but is there a better way of doing this because with set interval say like 10 minutes each and say if a user spends 8 minutes on a page and goes to next page , the interval starts all over again instead of 2 minutes .
so i was wondering if its possible to trigger a ajax request using something like php cron jobs or something of that sort to better handle this case .
cheers guys :)