在按钮单击期间,我想显示加载程序。相同的代码在Firefox中工作正常但不在crome中。 如果我将添加confirm()相同的代码也在crome中工作。还有其他任何一种吗? 我不想要我们确认()或setinterval()
$('#payment').on('click',function(){
showloader();// function to show loader and disable submit button
$.ajax({
url: "/payments/createccajax",
type: "POST",
cache: false,
async: false,
data: {
email: $('#PaymentsEmail').val(),
},
success: function(response) {
$('#jqxPopupCreditCardWindow').jqxWindow('close');// close popup
$('#ajaxmessage').prepend(response);
showbuttons(); // fxn to hide loader and enable the submit button
}
});
});
function showloader(){
alert('eede');
if (navigator.userAgent.toLowerCase().indexOf('msie') > -1) {
$("body").append($('<div id="imageloader" class="loader"><img id="spinner" src="/images/ajax-loader.gif" alt="Spinner" /></div>'));
} else {
$('#imageloader').css('display', 'block');
}
$('input[type=submit]').css({"opacity": ".2","cursor": "progress"});
$('input[type=submit]').attr("onClick", "return false");
$('input[type=submit]').prop("disabled", true);
$('input[type=button]').css({"opacity": ".2","cursor": "progress"});
$('input[type=button]').attr("onClick", "return false");
$('input[type=button]').prop("disabled", true);
}