0

I am using AJAX with jQuery. In desktop view AJAX working well while using with mobile devices or ipad AJAX is not working. It is showing 400 bad request error.

Here is my code:

jQuery.ajax({

        type: 'post',
        url: my_ajax_object.ajax_url,
        cache: false,
        data: {
            action: 'shows_month',
            currentDate: selectDate,
            showLimit: showvalue,
        },
        success: function(s){
            console.log(s);
            jQuery('.elements-area').html(s);
        },
        error: function(er){
            console.log(er);
        }
    }
  • 1
    Do you happen to be signed in in your desktop but not your other devices? – Jacob Peattie Mar 20 '18 at 7:07
  • no thats not the reason @jacob. no need to sign-in – Mukii kumar Mar 20 '18 at 7:08
  • 1
    You either need to sign in or hook the Ajax for signed out users too. See the duplicate post I flagged. – Jacob Peattie Mar 20 '18 at 7:09
  • 1
    @jacob i missed the spelling of 'wp_ajax_nopriv' to 'wp_ajax_noprv'. and that thing works. – Mukii kumar Mar 20 '18 at 7:19

Browse other questions tagged or ask your own question.