Android   发布时间:2022-04-28  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了android – Phonegap本地构建 – jquery ajax错误:readystate 0 responsetext status 0 statustext error大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
希望有人能提供帮助.

我正在开发@L_43_0@phonegap应用程序.

问题是,当我使用桌面浏览器或甚至是phonegap移动应用程序运行应用程序时,请求运行正常,但是当我使用CLI v5.4.1构建本地构建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://*/*"/>

我发现这非常奇特,在@L_197_10@了所有类似的问题后,我都没有回答.

我究竟做错了什么?

解决方法

您是否在索引文件中包含了内容安全元@L_618_14@?

Content Security Policy Cordova Reference

大佬总结

以上是大佬教程为你收集整理的android – Phonegap本地构建 – jquery ajax错误:readystate 0 responsetext status 0 statustext error全部内容,希望文章能够帮你解决android – Phonegap本地构建 – jquery ajax错误:readystate 0 responsetext status 0 statustext error所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。