Learning App Cordova

0

I am beginning to learn to program in cordova and I need a couple of things: - Do you know any guide to learn? - I have the following code and when I compile it with cordova run browser it works perfectly but then when I put it on the mobile when I press the button it does not do anything. Can you give me a little help or tell me where to find it?

                                                                                                             
                                                                           NEW User                                                                                    Password NEW                                                                                                                                                Submit Works APP                                                 

<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/index.js"></script>

 <script type="text/javascript">
        $("#loginButton2").click(function(mievento){
                    alert("Form Submitted");
            var url = "http://127.0.0.1/cordova/prueba_base/www/conectamos.php";
            var tusua = $("#useri").val(); 
            var tpass = $("#password").val(); 
            var dataString="tusuas="+tusua+"&tpasss="+tpass;
            $.getJSON(url, dataString, function(result) {
                $.each(result, function(i, field) {
                    var id = field.nombre;
                    var title = field.direccion;
                    var duration = field.telefono;
                    var price = field.movil;
                    if(id=="success")
                    {
                            localStorage.setItem("usuar", tusua);
                            localStorage.setItem("passi", tpass);
                            window.location.href = "clientes.html";
                    }
                    else
                    {
                            $("#datos").append(id);
                            $("#useri").val('');
                            $("#password").val('');
                    }
              });
            });
         }); //loginButton2

         $('#infoForm').submit(function() {

                var postTo = "http://127.0.0.1/cordova/prueba_base/www/conectamos.php";

                $.get(postTo,({tusuas: $('[name=useri]').val(), tpasss: $('[name=password]').val()}),
                function(data) {

                    $.each(data, function(i, field) {
                    var id = field.nombre; 
                    var title = field.direccion;
                    var duration = field.telefono;
                    var price = field.movil;
                    if(id=="success")
                    {
                            alert('succes');
                            tusua=$('[name=useri]').val();
                            tpass=$('[name=password]').val();

                            localStorage.setItem("usuar", tusua);
                            localStorage.setItem("passi", tpass);
                            window.location.href = "clientes.html";
                    }
                    else
                    {
                            $("#datos").append(id);
                            $("#useri").val('');
                            $("#password").val('');
                    }
                    });
                },'json');
                return false;
            });
</script>

Thank you.

    
asked by Cris Pons Garriga 13.10.2018 в 23:49
source

1 answer

0

I have already found the solution, the problem is that it did not set the IP well. I put the "localhost" and you have to put the one given by ipconfig or ifconfig. Thanks.

    
answered by 15.10.2018 в 22:06