2016-07-23 27 views
0

Ich möchte getJSON mit einem Apk builded mit Phonegap machen. Meine Funktion funktioniert auf dem Desktop, aber wenn ich es aus der apk ausführen, wird die Funktion nicht ausgeführt.getJSON funktioniert nicht auf Phonegap Build

Meine jQuery-Funktion:

$.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(); 
     } 
    }); 

Ich habe bereits diese

auf meinem config.xml hinzufügen
<allow-navigation href="http://*/*" /> 
<allow-navigation href="https://*/*" /> 
<allow-navigation href="data:*" /> 
<allow-navigation href="*" /> 
<access origin="*" /> 
<allow-intent href="*" /> 

Vielen Dank für Ihre Hilfe,)

(und sorry für mein Englisch Niveau)

Antwort

0

Es scheint, dass Sie die Whitelist-Plugin fehlt:

<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:*" />