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);
        }
    }
4
  • 1
    Do you happen to be signed in in your desktop but not your other devices? Mar 20, 2018 at 7:07
  • no thats not the reason @jacob. no need to sign-in Mar 20, 2018 at 7:08
  • 2
    You either need to sign in or hook the Ajax for signed out users too. See the duplicate post I flagged. Mar 20, 2018 at 7:09
  • 1
    @jacob i missed the spelling of 'wp_ajax_nopriv' to 'wp_ajax_noprv'. and that thing works. Mar 20, 2018 at 7:19

0

Browse other questions tagged or ask your own question.