I am facing an issue while using AJAX to fetch data from an external XML file. The error I receive is "Invalid argument" and I am working with IE 8.
Below is the code snippet:
var xhr;
xhr = new XMLHttpRequest();
xhr.open("GET","C:/Users/abc/Desktop/Project/POC/ajax/Data.xml", false);
xhr.onreadystatechange = function ()
{
if (xhr.readyState===4 && xhr.status===200)
{
var items = xhr.responseXML.getElementsByTagName('name');
var output = '<ul>';
for (var i=0; i<items.length; i++)
output += '<li>' + items[i].firstChild.nodeValue + '</li>';
output += '</ul>';
var div = document.getElementById('update');
div.innerHTML = output;
}
}
xhr.send();
The highlighted line is causing the error. Any suggestions on how to resolve this? Thank you in advance.