如何使用 Ajax 发送推送通知 Uraban Airship?
我尝试创建一个 ajax 调用,以使用城市飞艇推送服务向我的开发设备发送广播消息。使用门户网站进行通话效果非常好。但尝试将其用作 ajax 调用,但不幸的是它没有返回错误或成功。有人知道如何检查以下代码吗?
var ruleObj = {
"aps": {
"badge": 15,
"alert": "Hello from Urban Airship!",
"sound": "cat.caf"
}
};
var objStr = JSON.stringify(ruleObj);
jQuery(document).ready(function(jQuery){
jQuery.ajax({
type: "POST",
contentType:"application/json",
username: "Key ID NUM",
password: "Master ID NUM",
url:"https://go.urbanairship.com/api/push/broadcast/",
data: objStr,
success: function(data){
alert(data);
}
});
});
Ive tried creating an ajax call to send a broadcast message to my development device using urban airship push services. The call works great using the portal website. but tried to use it as ajax call and no luck it doesn't bring back an error or success. Would someone know how to check the following code?
var ruleObj = {
"aps": {
"badge": 15,
"alert": "Hello from Urban Airship!",
"sound": "cat.caf"
}
};
var objStr = JSON.stringify(ruleObj);
jQuery(document).ready(function(jQuery){
jQuery.ajax({
type: "POST",
contentType:"application/json",
username: "Key ID NUM",
password: "Master ID NUM",
url:"https://go.urbanairship.com/api/push/broadcast/",
data: objStr,
success: function(data){
alert(data);
}
});
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将请求参数更改为 -
"Key ID NUM":"Master ID NUM",
Change the request parameters to -
"Key ID NUM":"Master ID NUM",