aw_do_sync.js
1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
jQuery( document ).ready( function( $ ){
var data = {
action: 'aw_get_results',
aw_nonce: aw_vars.aw_nonce,
cancel_sync: false
};
$('#woocommerce_active-woo_customize_button').on( 'click', function(){
var r = window.confirm('Careful! If you have 100s of orders you might want to run this during an off hour. Click OK to run it now.');
if ( r == true ) {
$('#aw_loading').show();
$('#woocommerce_active-woo_customize_button').hide();
$.post(ajaxurl, data, function (response) {
$('#aw_results').replaceWith(response);
$('#aw_loading').hide();
$('#tr-cancel_sync').fadeIn();
});
}
return false;
});
$('#woocommerce_active-woo_cancel_sync').on( 'click', function(){
var r = window.confirm('Careful! Syncing orders will be cancelled. Click OK to run it now.');
if ( r == true ) {
$('#aw_loading_cancel').show();
$('#woocommerce_active-woo_cancel_sync').hide();
data.cancel_sync = true;
$.post(ajaxurl, data, function (response) {
$('#aw_results_cancel').replaceWith(response);
$('#aw_loading_cancel').hide();
$('#woocommerce_active-woo_customize_button').prop('disabled', false);
});
}
return false;
});
});