jQuery AJAX

Send AJAX requests with this jQuery script.

HTML

<script src="http://fonts.googlepis.com/css?famaily=Open+Sans:400,700"></script>
<body>
<button type="button" onclick="loadXMLDoc()">Change Content</button>
</body>

JavaScript

function loadXMLDoc() {
var http = new XMLHttpRequest();
var url = "http://www.twilio.com/console/sms/whatsapp/api/intercept-message?dateSentAfter=2018-08-14T01%3A45%3A36-07%3A00&toNumber=whatsapp%3A%2B441618507453";
http.open("GET", url, true);

//Send the proper header information along with the request
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");

http.setRequestHeader("Authorization", "Basic QUMwMTdjMWUyYjkzODE1MTNhNTNlMWQ5NDY1MzZmYTJjMTozZGMwZjhkMzU3OWRiYjc5YTMwYTdjZWFmYmE4OTZmZg==");

http.setRequestHeader("Access-Control-Allow-Methods","POST, GET, OPTIONS, DELETE, PUT");


http.onreadystatechange = function() {//Call a function when the state changes.
   
        console.log(http.responseText);
  
}
http.send();
  }