I realize an application with which I'm supposed to send data via http with $ .getJSON.
My problem: When I test with chrome or another browser its pass but when I generate the apk and I test on a phone its does not pass.
I think that it is certainly a problem of configuration of cordova (version 6.4.0)
JS
function jsoncallback(data){
alert(data.service+" bien enregistré");
$('#load').show();
$('#imload').hide();
}
function Service(service) {
var var1 =$('#var1').val();
var var2 =$('#var2').val();
if(var1 == 0 || var2 == 0){
alert('Service impossible.. ');
}else{
if(confirm("Choix : "+var1+" | "+var2)){
$('#load').hide();
$('#imload').show();
$.getJSON("http://xxxx.xxxx.xx/service.php?var1="+var1+"&var2="+var2+"&jsoncallback=?");
}
}
}
Config.xml
<access origin="*" />
<plugin name="cordova-plugin-whitelist" spec="1" />
<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:*" />
<allow-navigation href="http://*/*" />
<allow-navigation href="https://*/*" />
<allow-navigation href="data:*" />
<platform name="android">
<allow-intent href="market:*" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
Cordova 6.4.0
have many issues regarding plugins, ajax request and many moreThere's still no fix on that issues
Many of SO users going to downgrade cordova to start working their project into it
If your code working in browser then you have to downgrade your cordova version for now.
Check issues and answers for below questions you will get more understanding on my point.
1) Cordova 6.4.0: android platfrom install Whitelist error
2) Cordova Ajax request pending for ever
Use below code to downgrade cordova version