I am developing an application which requires that user must be notified about some background events i.e. invitation from other user, reminder time out etc.
Whenever t
Using code from @Anu's suggestion - my fiddle, you can simply add a poll
$(document).ready(function() {
$(".dismiss").click(function(){$("#notification").fadeOut("slow");});
setInterval(function() {
$.get("ping.jsp?userid=<%= userID %>",function(message) {
if (message) $("#notification").fadeIn("slow").html(message);
});
,10000);
})
the message could include a timestamp to see if you had notified earlier instead of sending an empty message if no notificati9on is needed
Alternatives: Long poll or Comet