簡體   English   中英

使用build.phonegap.com構建應用程序時,ajax請求不起作用

[英]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分配給$$。 你可以檢查一下。 檢查以下鏈接以獲取更多信息http://framework7.io/docs/dom7.html

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM