Androi1234
Lurker
Hi, I'm using phonegap with Ajax to call external xml file using
XMLHttpRequest. I send the request but response not come.The ready.status comes 403 in android device.
what is the problem.... below is the my code. this code work in
emulator but not work in android 3.1 tablet...
function appReady(){
var ajax = new XMLHttpRequest();
ajax.open("GET","http://search.twitter.com/search.json?
q=phonegap",true);
ajax.send();
ajax.onreadystatechange=function(){
if(ajax.readyState==4 && (ajax.status==200||
ajax.status==0)){ alert('asdas');
eval('var data = ' + ajax.responseText + ';');
var theResults = data.results;
var theHTML = '';
for(var i=0;i<theResults.length;i++){
theHTML += ['<div class="tweet"',
'<div class="avatar"> <img
src='+theResults.profile_image_url+' /></div>',
'<div
class="tweet_content">',
'<h2>'+theResults.from_user+'</h2>',
'<p>'+theResults.text+'</p>',
'</div>',
'</div>'].join('');
}
document.getElementById('main').innerHTML =
theHTML;
}
}
}
appReady();
XMLHttpRequest. I send the request but response not come.The ready.status comes 403 in android device.
what is the problem.... below is the my code. this code work in
emulator but not work in android 3.1 tablet...
function appReady(){
var ajax = new XMLHttpRequest();
ajax.open("GET","http://search.twitter.com/search.json?
q=phonegap",true);
ajax.send();
ajax.onreadystatechange=function(){
if(ajax.readyState==4 && (ajax.status==200||
ajax.status==0)){ alert('asdas');
eval('var data = ' + ajax.responseText + ';');
var theResults = data.results;
var theHTML = '';
for(var i=0;i<theResults.length;i++){
theHTML += ['<div class="tweet"',
'<div class="avatar"> <img
src='+theResults.profile_image_url+' /></div>',
'<div
class="tweet_content">',
'<h2>'+theResults.from_user+'</h2>',
'<p>'+theResults.text+'</p>',
'</div>',
'</div>'].join('');
}
document.getElementById('main').innerHTML =
theHTML;
}
}
}
appReady();
