I'm able to get the data from the filltext web api using Ajax GET request ,but when i use Post request then i can't see anything returned to the console and also no errors, how do i solve this?
const xhr = new XMLHttpRequest();
const url = 'http://www.filltext.com/?rows=1&pretty=true&id={index}&fname={sahil}&lname={keshav}&company={business}';
let test = JSON.stringify({
id:124,
fname:'sunil',
lname:'singh',
company:'reebok'
});
function getData(){
xhr.onreadystatechange = () => {
if(this.readyState === 4 && this.status === 200){
let tes = JSON.parse(this.responseText)
console.log(tes);
}
}
xhr.open('POST',url,true);
xhr.setRequestHeader('Content-type','application/json');
xhr.send(test);
}