JSFiddle - React, Tailwind, and code Playground
by Sivasakthi Chandrasekaran
HTML
<button>Send an HTTP POST request to a page and get the result back</button>
JavaScript
$(document).ready(function(){
$("button").click(function(){
alert("clicked");
var token = 'admin:rel12345';
var encodedToken = btoa(token)
var settings = {
"async": true,
"crossDomain": true,
"url": "https://nfrel.relevantmobile.com/api/v1/push_services/submit",
"method": "POST",
"headers": {
"content-type": "application/json",
"authorization": "Basic " + encodedToken
},
"processData": false,
"data": " {\n \"owner_email\": \"[email protected]\",\n \"chain_id\": \"70\", \n \"service_type\": \"1\", \n \"select_type\": \"manual_enter\", \n \"user_ids\": \"350427\", \n \"point\": \"11\", \n \"year\": \"2016\", \n \"month\": \"11\", \n \"day\": \"29\", \n \"hour\": \"01\", \n \"minute\": \"01\", \n \"time_zone_default\": \"EST\"}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
});
});