jQuery(document).ready(function ($) {
    $('#vserpb_update_schema_button').on('click', function (e) {
        e.preventDefault();

        var product_id = $('#vserpb_product_id').val();
        var nonce = vserpb_ajax_object.nonce;

        $.post(vserpb_ajax_object.ajax_url, {
            action: 'vserpb_update_product_schema',
            nonce: nonce,
            product_id: product_id,
        }, function (response) {
            if (response.success) {
                alert(vserpb_ajax_object.success);
            } else {
                alert(vserpb_ajax_object.error + ': ' + response.data);
            }
        });
    });

    $('.psm-tab').on('click', function () {
        var tab = $(this).data('tab');
        $('.psm-tab').removeClass('active');
        $(this).addClass('active');
        $('.psm-content').removeClass('active');
        $('#psm-tab-' + tab).addClass('active');
    });
});

