AJAX request randomly stop working and returns error 400

I have a problem with my WP-blog and I have no any idea how I can solve it.
I have custom pagination, wrote on jQuery and AJAX and some times it works fine but sometimes I have an error POST https://my-site.com/wp-admin/admin-ajax.php 400 (Bad Request)

Here is my code in functions.php:

add_action(‘wp_enqueue_scripts’, ‘ajax_paginator’);
function ajax_paginator()
{
wp_enqueue_script(‘ajax-paginator’, get_stylesheet_directory_uri() . ‘/js/ajax-paginator.js’);
}

and in ajax-paginator.js is usual jQuery code. So, what can be reason of this errors and how can I fix it?

Read more here:: AJAX request randomly stop working and returns error 400

Leave a Reply

Your email address will not be published. Required fields are marked *