| 1 |
/** |
| 2 |
* Uploads Page specific scripts. |
| 3 |
* |
| 4 |
* @author korotkov@UD |
| 5 |
*/ |
| 6 |
|
| 7 |
jQuery(document).ready(function(){ |
| 8 |
|
| 9 |
jQuery('.sm_inline_sync').one( 'click', function( e ) { |
| 10 |
|
| 11 |
var that = jQuery(this); |
| 12 |
|
| 13 |
that.html('Please wait...'); |
| 14 |
|
| 15 |
jQuery |
| 16 |
.ajax({ |
| 17 |
method: 'POST', |
| 18 |
url: ajaxurl, |
| 19 |
data: { |
| 20 |
action: that.data('type') == 'image' ? "stateless_process_image" : "stateless_process_file", |
| 21 |
id: that.data('id') |
| 22 |
} |
| 23 |
}) |
| 24 |
.done(function( response ) { |
| 25 |
if ( response.success ) { |
| 26 |
that.replaceWith( '<span style="color:#00520a">'+response.data+'</span>' ); |
| 27 |
} else { |
| 28 |
that.replaceWith( '<span style="color:#a00">'+response.data+'</span>' ); |
| 29 |
} |
| 30 |
}) |
| 31 |
.fail(function( jqXHR, textStatus, message ) { |
| 32 |
that.replaceWith( '<span style="color:#a00">'+message+'. Check your server configuration.</span>' ); |
| 33 |
}); |
| 34 |
}); |
| 35 |
|
| 36 |
}); |
| 37 |
|