SHOW:
|
|
- or go back to the newest paste.
1 | - | function myNotification() { |
1 | + | window.setInterval(function(){ |
2 | - | $.ajax({ |
2 | + | var output = ""; |
3 | - | url: 'http://1.2.3.4/notifications.php', |
3 | + | $.ajax({ |
4 | - | data: "id=8", |
4 | + | method: "POST", |
5 | - | dataType: 'json', |
5 | + | url: "http://1.2.3.4/notifications.php", |
6 | - | success: function(data) { |
6 | + | data: { id : 8 }, |
7 | - | var nid = data[0]; |
7 | + | dataType: "json", |
8 | - | var nmsg = data[1]; |
8 | + | success: function(data) { |
9 | - | $('#output').html("<b>id: </b>"+nid+"<b> Message: </b>"+nmsg); |
9 | + | jQuery.each(data, function(i,val) { |
10 | - | } |
10 | + | GrowlNotification.notify({ |
11 | - | }); |
11 | + | title: 'Ενημέρωση', |
12 | - | } |
12 | + | description: val.nmsg, |
13 | type: 'warning', | |
14 | position: 'top-right', | |
15 | closeTimeout: 0, | |
16 | showButtons: true, | |
17 | buttons: { | |
18 | action: { | |
19 | text: 'Ενημερώθηκα', | |
20 | callback: function() { | |
21 | $.ajax({ | |
22 | url: 'http://1.2.3.4/scripts/mark_notice_read.php?id='+ val.nid, | |
23 | success: function(){} | |
24 | }); | |
25 | } | |
26 | }, | |
27 | cancel: { | |
28 | text: 'Ακύρωση', | |
29 | callback: function() {} | |
30 | } | |
31 | }, | |
32 | }); | |
33 | }); | |
34 | } | |
35 | }); | |
36 | }, 5000) |