Pino Ciompi
Pino Ciompi

Reputation: 23

Intel xdk $.getJson fail on apk

I'm developing an app with Intel xdk, and i have to make a json request to a website. It works if i try the app from the xdk emulator and if i try with the app preview but i if build the apk file, install it, then the request fail.

This is the example call:

$.getJSON("http://time.jsontest.com", function(data){
alert(data);});

And this is the response:

GET http://time.jsontest.com/ 404 (Not Found)

My device is obviously connected.

In my index.html i have included "intelxdk.js" and "xhr.js" as this page says

Upvotes: 0

Views: 399

Answers (1)

Pino Ciompi
Pino Ciompi

Reputation: 23

Ok, solved.I had to add <access origin="*" /> to the config.xml file. More info here: https://cordova.apache.org/docs/en/4.0.0/guide_appdev_whitelist_index.md.html

Upvotes: 1

Related Questions