jQuery(document).ready(function ($) {
    $('#ajax-load-blog').on('submit', function (e) {
        e.preventDefault()
        var data = $(this).serialize()
        $.ajax({
            url: '/wp-admin/admin-ajax.php', // Use the AJAX URL from wp_localize_script
            type: 'POST',
            data: data,
            success: function (response) {
                $(".anons-article__card-wrap").append(response)
                $('#page_num').val(Number($('#page_num').val()) + 1)
                if (Number($('#page_num').val()) >= Number($('#ajax-load-blog').data('total'))){
                    $('#ajax-load-blog').hide()
                }
            },
            error: function (error) {
                
            }
        });
    });
});