我有以下代码试图从web加载XML文件。
$.ajax({
url: 'http://www.kumarchetan.com/blog/feed/',
success: function(xhrresponse){
$('#container').html(xhrresponse);//does nothing
navigator.notification.alert("Data Loaded: " + typeof xhrresponse);//tells me its an object
},
error: function(){
navigator.notification.alert("PC LOAD LETTER");
}
});
我试过使用$.get()
以及它没有工作。我将此代码替换为以下代码
$('#hiddenContainer').load('http://www.kumarchetan.com/blog/feed/');
它的工作原理类似于魅力。托管XML文件的服务器在服务器端没有特殊的事情。
编辑
我尝试添加dataType:'xml'
为好,这是行不通的。
您正在开发适用于iOS的应用程序吗? – Andrei 2012-01-05 10:15:01
@Andrei,它的Android版。 – Kumar 2012-01-05 10:22:33