Vote count:
0
I made a notifications for my web service. The code looks like this (two first lines are mental shortcut):
check_how_many_alerts();
loop count(check_how_many_alerts){
var n = new Notification("Alert!",{ icon: "alert.png", body: variable });
alert_name = variable;
n.onshow = function () {
setTimeout(n.close.bind(n), 10000);}
n.onclick = function() {
$.ajax({
url: 'notif_accept.php',
type: 'GET',
data: 'id=' + alert_name,
success: function(output)
{
alert('success, server says '+output);
}, error: function()
{
alert('something went wrong');
}
});
}
}
The problem is when I have two or more alerts, all of them have the same URL in .onclick function. What should I do to have URLs with different "alert_names"?
asked 23 secs ago
JavaScript - Notification API in webbrowser
Aucun commentaire:
Enregistrer un commentaire