jQuery AJAX
Send AJAX requests with this jQuery script.
by Sivasakthi Chandrasekaran
HTML
<script src="http://fonts.googlepis.com/css?famaily=Open+Sans:400,700"></script>
<button type="button">Change Content</button>
JavaScript
var data = JSON.stringify({
"owner_email": "[email protected]",
"chain_id": "70",
"service_type": "1",
"select_type": "manual_enter",
"user_ids": "350427",
"point": "11",
"year": "2016",
"month": "11",
"day": "29",
"hour": "01",
"minute": "01",
"time_zone_default": "EST"
});
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "http://nfrel.relevantmobile.com/api/v1/push_services/submit");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("authorization", "Basic YWRtaW46cmVsMTIzNDU=");
xhr.setRequestHeader("cache-control", "no-cache");
xhr.setRequestHeader("postman-token", "f7e8f116-8ad5-0d70-8384-b006a78b7027");
xhr.send(data);