ajax 使用 build.phonegap.com 构建应用程序时请求不起作用

ajax request not working when build app using build.phonegap.com

我尝试了一个星期各种解决方案,但没有任何效果,我不知道如何调试我的发布应用程序,在调试模式下应用程序一切正常!这是我的 html 代码

<meta http-equiv="Content-Security-Policy" content="default-src 'self' 'unsafe-eval' data: blob: filesystem: ws: gap://ready file: cdvfile: https://ssl.gstatic.com *; style-src * 'unsafe-inline'; script-src * 'unsafe-inline' 'unsafe-eval'; img-src * data: 'unsafe-inline'; connect-src * 'unsafe-inline'; frame-src *; worker-src *; child-src *;">

$.post("https://xxxxx/api/").done(function (data) {                             
   console.log(data);
})

config.xml:

<access origin="*" />
<allow-navigation href="*" />
<allow-intent href="*" />

php 代码:

header('Access-Control-Allow-Origin: *');
header('Content-Type: application/json');
$sendData[status] = 'ERROR';
$sendData[message] = 'no action command';
echo json_encode($sendData);    
exit();

我在这里错过了什么?

您是否尝试过在 config.xml 文件

的应用程序中包含白名单插件
cordova plugin add cordova-plugin-whitelist
cordova prepare

您可以在这里阅读:https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-whitelist/

由于冲突问题,在使用 Framework7 时无法使用 $ 访问 DOM7。使用“$$”代替“$”。 DOM7 在应用程序初始化时分配给 $$。你可以检查一下。查看下面的 link 了解更多信息 http://framework7.io/docs/dom7.html