I want the button to be disabled during the ajax request and the loading icon appears. I made the following script:
$(document).ready(function(){
//Clicar no botão deletar selecionadas
$('#deleteSelecionados').click( function () {
//Desabilita o botao
$("#deleteSelecionados").attr("disabled", "disabled");
//Mostra icone de carregando
$("#loadIcon").css('visibility','visible');
//Solicitação ajax
jQuery.ajax({
url: strUrl,
success: function(json) {
// qualquer coisa
},
async:false
});
//Habilita botao
$("#deleteSelecionados").removeAttr("disabled");
//remove icone
$("#loadIcon").css('visibility','hidden');
});
});
The process works correctly in FireFox but in Chorme when executed nothing happens, when I run with the javascrip debug by chrome it works perfectly disabling the button and showing the icon. The feeling is that it does not update the screen during the normal process, only when it is in debug mode.
Does anyone have any idea how to solve this?