通过PushOver的Javascript(Userscript)智能手机通知

时间:2014-11-06 23:23:01

标签: javascript android push-notification push pushover

我尝试使用用户手册中的PushOver AVI向我的智能手机发送消息。

代码如下所示:

function sendMsg() {

    $.ajax({
        type: "POST",
        url: "https://api.pushover.net/1/messages.json",
        datatype: "application",
        token: "xxXxXxXXXxXx",
        user: "xXxXXYXxyxX",
        device: "samsungs4",
        message: "This is a test message",
        sound: "echo",
        success: function(){ console.log("Message sent"); },
        error: function(){ console.log("Couldn't send message"); }
    });
}

但是,当我从一个随机网站(在用户脚本中添加为@match)执行此脚本时,我收到错误400“错误请求”。

根据他们的API,我的请求看起来很好,我想不出任何为什么它不起作用。

也许有经验的人可以帮助我。

1 个答案:

答案 0 :(得分:0)

将所有内容发布为数据:解决问题。

相关问题