Ajax does not work on android

Asked

Viewed 737 times

-1

I’m making a request ajax that works perfectly on the Desktop, but when I test on android does not work, if anyone can help me

jQuery(document).ready(function($){
        $("#loginform").on('submit', function() {
            var input_data = $('#loginform').serialize();
            $.ajax({
                type: "POST",
                url: "<?php echo site_url('wp-login.php','login_post'); ?>",
                data: input_data,
                success: function(msg) {
                    var reg1 = /login_error/g;
                    if (reg1.test(msg)) {
                         $('#message').html("Usuário ou senha incorretos.");
                    }else {
                        // login success. redirect users to some page.
                        //$(location).attr('href', '/my-account/');
                        //or reload the same page
                        if($('#user_pass').val() != '' && $('#user_login').val() != '') {
                          location.reload();
                        } else {
                          $('#message').html("Usuário ou senha não preenchidos!");
                          $('#message').fadeIn();
                        }
                    }
                }
            });
            return false;
        });
    });

  • In the browser or in a WebView?

  • In the browser, Google Chrome Android 5.1

1 answer

0

Add jQuery mobile to your project. It allows you to use jQuery commands for all mobile devices, both Ios and android. After entering the project, just use jQuery the way you’re used to it.

Note: Check which version of jQuery is used in your project, so you can download a compatible version of jQuery mobile.

Link: https://jquerymobile.com/

  • I inserted the mobile jquery and nothing... the link is this https://sbacv-go.com.br/minha-conta/ and the error is in google Chrome of android 5.1, iphone and newer versions of android works normally

  • Do you know the error? You try to debug Chrome in your browser paired with your mobile phone by the Chrome://Inspect/#Devices link in your Chrome

  • I try to display the error and does not show, only know that of the error because I added in ajax the error event and I gave an Alert then it falls in the error Alert being that in the Desktop and other devices falls in the Success Alert, I am thinking of ignoring the fact that several other devices did not show error, only in Moto G

  • Try a remote debug of the error as it explains this https://tableless.com.br/debug-remoto-chrome-android/ link. With the error in hand, maybe it’s easier to solve.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.