jQuery(document).ready(function ($) {
    // ID generated by Woo settings is: woocommerce_{gateway_id}_{field_key}
    $('#woocommerce_flux_gateway_button_sync_products').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);
            });
        }
    });
});



