jQuery(document).ready(function ($) {
    $('#woocommerce_flux_gateway_button_text').on('click', function (e) {
        e.preventDefault();
        if (confirm('Sync all products to Flux?')) {
            $.post(ajaxurl, {
                action: 'flux_sync_products',
                _wpnonce: flux_admin.nonce
            }, function (response) {
                alert(response.data ? response.data : response);
            });
        }
    });
});

