jqueryxml加载&;作语法分析
Chrome浏览器不加载或解析我的xml。我在不是本地的服务器上测试它。Chrome在错误函数中跳转。在FF上一切都好jqueryxml加载&;作语法分析,xml,google-chrome,jquery,xml-parsing,get,Xml,Google Chrome,Jquery,Xml Parsing,Get,Chrome浏览器不加载或解析我的xml。我在不是本地的服务器上测试它。Chrome在错误函数中跳转。在FF上一切都好 $.ajax({ type: 'GET', url: XML_PATH, dataType: "xml", aSync: false, success: function onXMLloaded(xml) { console.log('Succ
$.ajax({
type: 'GET',
url: XML_PATH,
dataType: "xml",
aSync: false,
success: function onXMLloaded(xml)
{
console.log('Success');
// loop for each item
$(xml).find('item').each(function loopingItems(value){
// create an object
var obj={urls:$(this).find("urls").text()};
// push in object
videos_array.push(obj);
});
},
error: function() {
console.log('Error');
},
complete: function() {
console.log('Complete');
}
有人有主意吗?非常感谢 好的。以下是ist的工作原理: `log('Beginne XML');$。ajax({type:'GET',
url:XML_路径,数据类型:“text”,异步:false,成功: 函数(文本){ console.log('Success'); //每个项目的循环 $(文本)。查找('item')。每个(函数循环项(值){ //创建一个对象变量 obj={url:$(this).find(“url”).text()}; //推入式对象 视频_array.push(obj); }); }, `
数据类型是问题所在。现在可以正常工作:-)谢谢大家!我从未见过类似
success:function onxmloaded(xml)
——尝试用success:function(xml)替换它
谢谢。我尝试过,但没有效果。我在控制台中看到xml,但它跳入错误并完成。有JavaScript错误吗?控制台中没有错误或其他内容。好的。下面是ist的工作方式:console.log('Beginne xml');$.ajax({type:'GET',url:xml_PATH,dataType:'text“,aSync:false,success:function(text){console.log('success');//每个项的循环$(text.find('item')。每个(function loopingItems(value){//创建一个对象var obj={url:$(this.find('url').text()};//推入对象视频_array.push(obj);}},谢谢大家!