javascript - Error in getting data from xml using AJAX -
i using ajax reading data external xml file giving error "invalid argument" using ie 8
pfb code:
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>'; (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 line in bold giving error. idea ? in advance
you should using url not path, change :
xhr.open("get","c:/users/abc/desktop/project/poc/ajax/data.xml", false); to, like
xhr.open("get","http://localhost/your_project/poc/ajax/data.xml", false);
Comments
Post a Comment