Reputation: 71111
Is there a notification library written for jQuery already? One that would provide dropdown messages similar to the way StackOverflow does it.
Looking for something that:
1) Polls every couple of seconds (maybe option to do Comet)
2) Has a mark-as-read call (noticed StackOverflow does this via a POST request)
Upvotes: 1
Views: 1023
Reputation: 407
It's been awhile since this was asked, but for future reference, check out Pines Notify at http://pinesframework.org/pnotify/.
If you're using .NET, then check out SignalR as well at http://signalr.net/.
Pines Notify gives you javascript-based pop-up notifications. You can theme the popups using either jQueryUI or BootStrap, and can provide either blocking or non-blocking notifications.
SignalR handles the communications side. It's extremely flexible and very simple to use. It allows you to call javascript methods from .NET, and .NET methods from javascript.
Put them together, and you've got a very nice notification package with very little work.
Upvotes: 1
Reputation: 4950
Have a look at Socket.IO. It uses Node-js on the server side, but you may use the javascript-client socket.io.js independently.
It chooses the best transport available in the browser and gives you a nice api based on an event-system.
There is also a list of server implementations in different programming languages in the wiki.
Upvotes: 1
Reputation: 50976
Why would you need library??
client-side
<script>
setInterval(function(){
$.getScript({url:"news.php"});
}, 10000);
</script>
server-side
<?php
$data = newdata();
if ($data)
{
echo "alert('new data avaible');";
}
?>
button to mark as read:
server-side
<?php
mark_as_read($_GET['id']);
client-side
<script>
function mark_as_read(markID){
$.ajax({"url": "mark_as_read.php?id="+markID"});
}
</script>
Upvotes: 3
Reputation: 2619
Not that I know of. Half of the work will need to be done on the server side anyways. I made a MUD in with JQuery/Asp.NETC# here at http://www.strategynerd.com/sngames
It shows a basic polling method. Since it uses live communication it polls quickly, but the less active you are the slower the polling starts to go. Comet and long polling are obviously much better than this method though.
Upvotes: 0