This request only work with internet explorer, I've tried many different solutions, for two days I've been trying to make it work and I couldn't . please advise.
pure javascript:
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
data = xmlhttp.responseText;
console.log(data);
document.getElementById("p").innerText = data;
}
};
xmlhttp.open("GET", "http://myanimelist.net/api/anime/search.xml?q=naruto", true);
xmlhttp.setRequestHeader('Authorization','Basic TUFMUTpNTU1xcXExMTEyMjJAQEAjIyM=');
xmlhttp.send(null);
jquery:
$.ajax({
url: "http://myanimelist.net/api/anime/search.xml?q=naruto",
cache: false,
headers: {"Authorization": "Basic TUFMUTpNTU1xcXExMTEyMjJAQEAjIyM=" ,"Content-Type": "application/xml"},
method: 'GET',
dataType: 'xml',
async: true,
success: function(data) {
var xmlText = new XMLSerializer().serializeToString(data);
var xmlTextNode = document.createTextNode(xmlText);
var parentDiv = document.getElementById('sdiv');
parentDiv.appendChild(xmlTextNode);
}
});