JSFiddle - React, Tailwind, and code Playground
by dshilkret
HTML
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<div id="response">
Response
</div>
JavaScript
var query ="<div>"+ "queryhtml:" + "dogs" + "</div>";
//var qb= JSON.stringify(query);
var requestBody = {"querytext": query};
var client=new XMLHttpRequest();
client.open("post","https://dev29198.service-now.com/api/now/table/x_150952_elastic_s_query_context");
client.setRequestHeader('Accept','application/json');
client.setRequestHeader('Content-Type','application/json');
//Eg. UserName="admin", Password="admin" for this code sample.
client.setRequestHeader('Authorization', 'Basic '+btoa('admin'+':'+'Felicity1!'));
client.onreadystatechange = function() {
if(this.readyState == this.DONE) {
document.getElementById("response").innerHTML=this.status + this.response;
}
};
client.send(requestBody);