I have following piece of code which tries to load an XML file from web.
$.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");
}
});
I tried using $.get() as well but it didnt work. I replaced this code with following
$('#hiddenContainer').load('http://www.kumarchetan.com/blog/feed/');
And it works like charm. The server that hosts XML files doesn’t have anything special done at server side.
EDIT
I tried adding dataType:'xml' as well, it doesn’t work.
Realised that I had to add a timeout of 5 seconds before I start using the XML response.