BrandonSmith8038
9/25/2017 - 8:39 PM

XHR Post Request

XHR Post Request

const xhr = new XMLHttpRequest;
const url = 'https://api-to-call.com/endpoint';

const data = JSON.stringify({id: '200'});

xhr.responseType = 'json';

xhr.onreadystatechange = function(){
  if(xhr.readyState === XMLHttpRequest.DONE ){
    console.log(xhr.response);
  }
 
  
}
  xhr.open('POST',url);
	xhr.send(data);