【发布时间】:2019-10-10 19:44:35
【问题描述】:
我正在使用 PUSHER 进入我的网站以获取通知。 我成功添加了代码及其工作。 但问题是当警报被触发时,我正在接收消息,但它不是我想要的。
我从 Javascript alert() 收到这条消息;
{"message":"A new appointment arrived"}
alert message from pusher 我的代码是
var channel = pusher.subscribe('my-channel');
channel.bind('my-event', function(data) {
document.getElementById('audio').play();
alert(JSON.stringify(data));
$.ajax({url: "notification", success: function(result){
$("#notification").html(result);
}})
});
这就是我得到这个的地方。
$data['message'] = 'A new appointment arrived';
$pusher->trigger('my-channel', 'my-event', $data);
我收到来自
的消息JSON.stringify(data)
我的问题是,有没有办法可以从警报消息中删除除A new appointment arrived 之外的所有内容?
提前致谢。
我是初学者,对 Javascript 知之甚少。
【问题讨论】:
标签: javascript php json alert pusher