Request ajax works in browser and emulator of android not Cordova

0

Hello! I am developing my first application in Cordova, I use an ajax requirment for a php file that returns a json. Testing in chrome, everything happens well, but when I generate the .apk to test in the android's AVD the request does not work.

    $( "#FormLogin" ).submit(function(e) {
   $.ajax({
            async: true,
            type: "POST",
            url: "http://127.0.0.1/login/procLogin.php/", 
            data: {
                acao: 'LoginWeb',
                usuario: $("#usuario").val(),
                senha: $("#senha").val()
            },            
            async: false,
            dataType: "json", 
            success: function (json) {

                if(json.result == true){
                    alert('logou com sucesso ' + '\n'
                           +'Endereo: '+ json.dados.endereco + '\n'
                           +'Ativo: '+ json.dados.ativo + '\n'
                           +'Usuario: '+ json.dados.usuario +'\n'
                           +'Senha: '+ json.dados.senha +'\n'
                           +'ID Escola:'+ json.dados.idEscola );
                    logar();

                }else{
                   alert(json.msg);

                }
            },error: function(e,xhr,t){
                alert(xhr.responseText);                
            }
        });
});

Config.xml file:

    
asked by anonymous 10.03.2018 / 19:03

0 answers