我正在尝试将xmldocument内容加载到变量中,但没有成功。
返回的数据未定义。这里有什么问题?
当我使用firebug时,我发现所有xml代码的响应都已正确填充。
有人能帮助我吗?
function loadXmlForm()
{
jQuery.support.cors = true;
alert('Start');
$.ajax({
async: false,
type: "GET" ,
url: template_path + 'axFormDefinition.xml',
dataType: "xml",
success: function(data) {
alert(data);
}
});
}
更新: - > ajax调用生成错误,它不会进入成功块,其中responseText返回xml代码....任何想法为什么?
function loadXmlForm()
{
var xml;
jQuery.support.cors = true;
$.ajax({
async: false,
type: "GET" ,
url: template_path + 'axFormDefinition.xml',
dataType: "xml",
success: function(data){
xml = data;
},
error: function (xhr, ajaxOptions, thrownError) {
returnxhr.responseText;
}
});
return xml;
}
这里有请求详细信息(您可以看到我在响应中成功获取了xml代码,但是ajax调用返回错误)。是因为响应头是空的吗?