2
I want the button to be disabled during the ajax request and the loading icon to appear. 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 debug of javascrip by Chrome it works perfectly disabling the button and showing the icon. The feeling is that it doesn’t update the screen during normal process, only when it is in debug mode.
Does anyone have any idea how to fix this?
Thanks for the suggestion, but still not solved the problem!
– Luciano Marqueto
I do not understand, why did you mark it as correct if it did not solve the problem Luciano?
– Renan Gomes
Doing as you suggested and removing the async:false clasula. worked correctly.
– Luciano Marqueto