XMLHttpRequest在chrome中不起作用?为什么? [英] XMLHttpRequest not works in chrome ? why ?

查看:593
本文介绍了XMLHttpRequest在chrome中不起作用?为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hi Team,

我想使用XMLHttpRequest读取xml。下面的代码工作正常firefox但不能在Chrome中工作。



xmlhttp = new XMLHttpRequest();

xmlhttp.open(xmlpath,false);

xmlhttp。 setRequestHeader('Content-Type','text / xml');

xmlhttp.send();

xmlDoc = xmlhttp.responseXML;



i不知道,该怎么做。如果有人知道分享我的答案。





问候

Nanda Kishore.CH

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

推荐答案

您可以尝试使用jQuery,这将消除任何浏览器不一致。

虽然它应该可以工作。所以也许可以选择Solai Raja的建议。
You could try using jQuery, that will take away any browser inconsistenties.
Although it should work. So maybe go for Solai Raja's advice.


查阅文档open,第一个参数是方法(get,post等)然后是url和asynch



Consult the documentation for "open", the first param is the method (get, post etc) and then the url and asynch

xmlhttp.open("GET", xmlpath, false);


这篇关于XMLHttpRequest在chrome中不起作用?为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆