3
I am using pure javascript to send an AJAX with the Access_token header with a key inside, because the web-service asks for this request... but it is not going as I would like.
I want you to stay like this:
But it’s getting like this:
It follows my function: Function function(){
var xmlhttp;
if (window.XMLHttpRequest){
xmlhttp=new XMLHttpRequest();
}else{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function(){
if (xmlhttp.readyState==4 && xmlhttp.status==200){
document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("POST","https://www.asaas.com/api/v1/customers?name=Lucas",true);
xmlhttp.setRequestHeader('Access_token', 'bdb4b600eee96f16bf118c617a65561eba06629525c07f6564b9531a38959468');
xmlhttp.setRequestHeader('Content-Type', 'application/json');
xmlhttp.onreadystatechange = handler;
xmlhttp.send();
}
Which browser are you trying from? Is your app’s domain the same as the requested resource? And finally, you could provide the source of the request and response?
– Rui Pimentel