Javascript

Javascript - Jquery Method

1
var settings = {
2
"async": true,
3
"crossDomain": true,
4
"url": "https://pickyassist.com/app/api/v2/push",
5
"method": "POST",
6
"headers": {
7
"content-type": "application/json"
8
},
9
"processData": false,
10
"data": "{\"token\":\"c2a0b6221c5dd55ceb09ae1f74e46521756d\",\"priority \":0,\"application\":\"2\",\"sleep\":0,\"globalmessage\":\"\",\"globalmedia\":\"\",\"data\":[{\"number\":\"1212\",\"message\":\"Test\"}]}"
11
}
12
13
$.ajax(settings).done(function (response) {
14
console.log(response);
15
});
Copied!

Javascript - XMLHttpRequest

1
var data = JSON.stringify({
2
"token": "c2a0b6221c5dd55ceb09ae1f74e46521756d",
3
"priority ": 0,
4
"application": "2",
5
"sleep": 0,
6
"globalmessage": "",
7
"globalmedia": "",
8
"data": [
9
{
10
"number": "1212",
11
"message": "Test"
12
}
13
]
14
});
15
16
var xhr = new XMLHttpRequest();
17
xhr.withCredentials = true;
18
19
xhr.addEventListener("readystatechange", function () {
20
if (this.readyState === this.DONE) {
21
console.log(this.responseText);
22
}
23
});
24
25
xhr.open("POST", "https://pickyassist.com/app/api/v2/push");
26
xhr.setRequestHeader("content-type", "application/json");
27
28
xhr.send(data);
Copied!
Last modified 2yr ago