我为我的Web服务发出了通知。代码如下所示(两个第一线的精神快捷方式):JavaScript - 浏览器中的通知API
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');
}
});
}
}
问题是,当我有两个或两个以上的警报,个个都在.onclick功能相同的URL。我应该怎样做才能使URL具有不同的“alert_names”?
不知道网址,你正在谈论。显示的代码中没有任何内容涉及URL的 – charlietfl 2014-10-18 11:31:12