jquery - Using PhoneGap, can't load local .html file using Ajax on Android only -


i'm using phonegap (latest), jquery 1.7. i'm having troubles getting html loaded via ajax div. problem simple, have index.html file in www/ directory. , js file this:

$.ajax({  type:"get",  timeout:10000,  datatype: "html",  async: false,  cache: false,  url: "file:///android_asset/www/_liqui-cult.html",  success: function(data) {   $('#data_details .description').html(data); // never runs  },  error: function(xhr,msg){    alert(xhr.status + ", " + msg);    if(xhr.status == 0 || xhr.status == "0"){     alert(xhr.responsetext); // blank, if runs    }  } }); 

having spent day googling error, i've tried numerous things, ajax call never succeeds. i've tried changing url simply, _liqui-cult.html (without file:// -based url). i've tried /_liqui-cult.html.

i started out trying jquery $.load, , wasn't working, switched more verbose $.ajax call.

no matter do, either 404 status, or, if change url http://_liqui-cult.html, status of 0, nothing in responsetext.

so, took jquery out of equation, , tried simple xmlhttprequest, so:

var xmlhttp = new xmlhttprequest(); xmlhttp.onreadystatechange=function() {   if (xmlhttp.readystate==4 && (xmlhttp.status==200 || xmlhttp.status==0))   {     $('#data_details .description').html(xmlhttp.responsetext);     $.mobile.changepage('#screen_detail');   } } xmlhttp.open("get","_liqui-cult.html", true); xmlhttp.send(null); 

again, i've tried every conceivable url pattern map html file. , still, best can xmlhttp.responsetext blank.

so how cross-origin issues? here i've tried: <access origin=".*"/> <access origin="file://*"/> <access origin="*"/>

again, i've tried ways of mapping html file, different access origin settings, , still cannot load html file.

any ideas?

changing name of html file gets ajax-loaded "_liqui-cult.html" same name without underscore "liqui-cult.html" fixed problem.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -