Cordova 2.9.0 Android, cross domain Ajax request always fail

526 Views Asked by At

I have set <access origin="*"/> in config.xml, I use jquery and jquery mobile, so i set $.support.cors = true; $.mobile.allowCrossDomainPages = true, but the $.get(...) and $.ajax(...) fail even in desktop browser. After i use JSONP, I can successfully do cross site request in brwoser and Cordova simulator, but still fail in real device. I also tried promisejs, but still without luck. Seems that in real device the request always fail(not sent), from the server side there is no request at all.

Any help would be appreciated.

1

There are 1 best solutions below

1
On

This will only work if you build your application as an apk (android app) and install it on an android device, the fastest way to do so is to upload your zipped project to phonegap build and download the apk and run it on your phone.