getJSON 不适用于 phonegap 构建

getJSON doesn't work on phonegap build

我想用 phonegap 构建的 apk 制作 getJSON。我的功能在桌面上工作,但是当我从 apk 运行 时,该功能没有执行。

我的jQuery函数:

$.getJSON( url, function( data ) {
      var items = [];
        if (data.state == 'ok'){
            $('#succes').html("Votre compte a été créé");
        }
        else { 
            $('#succes').hide();
            $('#erreur').html("Une erreur est survenue !");
            $('#erreur').fadeIn();
        }
    });

我已经把这个添加到我的 config.xml

<allow-navigation href="http://*/*" />
<allow-navigation href="https://*/*" />
<allow-navigation href="data:*" />
<allow-navigation href="*" />
<access origin="*" />
<allow-intent href="*" />

感谢您的帮助 ;)

(对不起我的英语水平)

看来您缺少白名单插件:

    <access origin="*"/>
    <!-- Added the following intents to support the removal of whitelist code from base cordova to a plugin -->
    <!-- Whitelist configuration. Refer to https://cordova.apache.org/docs/en/edge/guide_appdev_whitelist_index.md.html -->
    <plugin name="cordova-plugin-whitelist" version="1" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />