/**
* Uploads Page specific scripts.
*
* @author korotkov@UD
*/
jQuery(document).ready(function(){
jQuery('.sm_inline_sync').one( 'click', function( e ) {
var that = jQuery(this);
that.html('Please wait...');
jQuery
.ajax({
method: 'POST',
url: ajaxurl,
data: {
action: that.data('type') == 'image' ? "stateless_process_image" : "stateless_process_file",
id: that.data('id'),
size: that.data('size')
}
})
.done(function( response ) {
if ( response.success ) {
if (that.data('reload_page')) {
location.reload();
}
that.replaceWith( ''+response.data+'' );
} else {
that.replaceWith( ''+response.data+'' );
}
})
.fail(function( jqXHR, textStatus, message ) {
that.replaceWith( ''+message+'. Check your server configuration.' );
});
});
});