Im trying to send a message to my smartphone using the PushOver AVI in a Userscript.
The code looks like this:
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"); }
});
}
However, when I execute this script from a random website (added as @match in the user script) I get error 400 "bad request".
According to their API my request looks just fine and I can't think of anything why it wouldn't work.
Maybe someone with more experience could help me out.
Post everything as data: solves the problem.