英特尔 xdk $.getJson 在 apk 上失败
Intel xdk $.getJson fail on apk
我正在使用 Intel xdk 开发应用程序,我必须向网站发出 json 请求。
如果我从 xdk 模拟器尝试应用程序,如果我尝试使用应用程序预览,但我如果构建 apk 文件,安装它,那么请求失败。
这是示例调用:
$.getJSON("http://time.jsontest.com", function(data){
alert(data);});
这是回复:
GET http://time.jsontest.com/ 404 (Not Found)
我的设备显然已连接。
在我的 index.html 中,我已经包括了 "intelxdk.js" 和 "xhr.js",正如 this page 所说
好的,solved.I 必须将 <access origin="*" />
添加到 config.xml 文件。
更多信息在这里:https://cordova.apache.org/docs/en/4.0.0/guide_appdev_whitelist_index.md.html
我正在使用 Intel xdk 开发应用程序,我必须向网站发出 json 请求。 如果我从 xdk 模拟器尝试应用程序,如果我尝试使用应用程序预览,但我如果构建 apk 文件,安装它,那么请求失败。
这是示例调用:
$.getJSON("http://time.jsontest.com", function(data){
alert(data);});
这是回复:
GET http://time.jsontest.com/ 404 (Not Found)
我的设备显然已连接。
在我的 index.html 中,我已经包括了 "intelxdk.js" 和 "xhr.js",正如 this page 所说
好的,solved.I 必须将 <access origin="*" />
添加到 config.xml 文件。
更多信息在这里:https://cordova.apache.org/docs/en/4.0.0/guide_appdev_whitelist_index.md.html