Incrementing PHP variable onclick to display posts by month

Try registering a function handling ajax calls first.

// For logged out users
add_action( 'wp_ajax_nopriv_wp280265_pagination', 'wp280265_pagination' );
// For logged in users
add_action( 'wp_ajax_wp280265_pagination', 'wp280265_pagination' );

Define the function.

function wp280265_pagination() {
    $month = $_POST['month'];
    $year = $_POST['year'];

    if ($month != '' && $year != '')
        get_posts($month, $year);
}

Define JavaScript.

(function($) {
    $(document.body).on('click', '#previous', function(e) {
        e.preventDefault();
        var month = $(this).data('month');
        var year = $(this).data('year');
        $.ajax({
            url: ajaxpagination.ajaxurl,
            type: 'post',
            data: {
                action: 'wp280265_pagination',
                month: month,
                year: year
            },
            success: function(result) {
                $(this).data('month', month + 1);
                $(this).data('year', year + 1);
            }
        })
    });
})(jQuery);

Enqueue and register.

add_action( 'wp_enqueue_scripts', 'ajax_wp280265_enqueue_scripts' );
function ajax_wp280265_enqueue_scripts() {
    wp_enqueue_script( 'wp280265', plugins_url( '/ajaxpagination.js', __FILE__ ), array('jquery'), '1.0', true );
    wp_localize_script( 'wp280265', 'ajaxpagination', array(
        'ajaxurl' => admin_url( 'admin-ajax.php' )
    ));
}

Didn’t test the code but the process should be correct.