I think this is what you're looking for:
- the pressed button will be disabled
- a deferred promise will wait until the until the
ajax()
call is complete - then deferred action will re-enable the button
::
buttons: {
"DoAjax": function( e ) {
//disabling button clicked
var btnAjax = $(".ui-dialog-buttonpane button:contains('DoAjax')");
btnAjax.disable(true);
$.when( $.ajax( "/api/controller/action" ) )
.then(function( data, textStatus, jqXHR ) {
// re-enable pressed button
btnAjax.disable(false);
})
}),
"Close":
}