我有以下脚本
$.ajax({
type:"GET",
url:"views/jquery/js/private/visual_constructor/proxy.php",
data:null,
timeout:55000,
dataType:"xml",
error:function(XMLHttpRequest, textStatus, errorThrown){
alert("error="+XMLHttpRequest+" error2="+textStatus+" error3="+errorThrown);
},
success:function(response){
alert('sucess');
}
});
proxy.php 的内容如下。
<?php
header('Content-type: application/xml');
echo file_get_contents('http://server.name/somefile.php');
?>
它连接到另一台服务器,在该服务器上somefile.php
生成一些 xml 内容并打印出来。
它在 Chrome 中完美运行,但在 Mozilla 中它显示我的错误警报。
这里有什么问题?
更新 1
我正在使用萤火虫,它说一切都很好。即使它显示来自服务器的响应。这是我的错误警报打印的内容:
error=[object XMLHttpRequest] error2=parsererror error3=parsererror
更新 2
当我从 Mozilla 打开http://server.name/somefile.php时,它会显示以下消息:
XML Parsing Error: not well-formed
Location: http://authoringtool/views/jquery/js/private/visual_constructor/proxy.php
Line Number 8, Column 94: <xs:annotation><xs:documentation xml:lang="en">Network Type</xs:documentation></xs:annotatin>
但是当我再次从 Chrome 中打开它时,它并没有显示错误,而是打印了 somefile.php 的内容