XMLHttpRequest not works in chrome ? why ?

Posted by Nandkishorre under JavaScript on 2/26/2015 | Points: 10 | Views : 1983 | Status : [Member] | Replies : 1
Hi Team,
I want to read xml using XMLHttpRequest. below code works fine firefox but not working in Chrome.

xmlhttp = new XMLHttpRequest();
xmlhttp.open(xmlpath, false);
xmlhttp.setRequestHeader('Content-Type', 'text/xml');
xmlhttp.send();
xmlDoc = xmlhttp.responseXML;

i don't know, what to do. if any one know about the share me the answer.


Regards
Nanda Kishore.CH




Responses

Posted by: Jitendrasoft09 on: 2/28/2015 [Member] [MVP] Starter | Points: 25

Up
0
Down
Hi,

It be could be the issue of java script is not enable in chromo. Or add below code for chromo-

if(window.XMLHttpRequest && navigator.appName.indexOf("Chromo")<0) {

xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET",xmlpath,false);
xmlhttp.send();
xmlDoc = xmlhttp.responseXML;
}

Please refer below link for more details-
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/XML/Q_27268927.html


Jitendra Kumar
If my post helps you, plz mark as an answer.

Nandkishorre, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response