【发布时间】:2016-05-20 08:05:31
【问题描述】:
希望有人能提供帮助。
我正在开发一个 phonegap 应用程序。
问题是,当我使用桌面浏览器甚至 phonegap 移动应用程序运行应用程序时,请求运行正常,但是当我使用 CLI v5.4.1 phonegap build android 在本地构建时,cli 输出在 projectroot/platforms/android/ build/outputs/apk/android-debug.apk 我收到错误“readystate 0 responsetext status 0 statustext error”
这是我的代码
$.ajax({
type: 'GET',
url: "http://www.domain.com/gateway.php?structure",
timeout: 5000,
success: function(result) {
var res = JSON.parse(result);
res.forEach(function(element, index) {
System.structure[element.company.id] = element;
});
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
alert('error: ' + JSON.stringify(XMLHttpRequest));
}
})
这是我的 config.xml
<plugin name="cordova-plugin-inappbrowser" source="npm"/>
<plugin name="phonegap-plugin-push" source="npm" />
<icon src="icon.png"/>
<access origin="*"/>
<plugin name="cordova-plugin-whitelist" version="1" />
<allow-intent href="http://*/*"/>
<allow-intent href="https://*/*"/>
我觉得这很奇怪,在搜索了所有类似的问题后,我没有得到任何答案。
我做错了什么?
【问题讨论】:
标签: android jquery ajax cordova config