我在我建立的小型库中有以下功能:
HB.FormButtons.inputs = $("input[type='submit'], input[type='button'], button[type='submit'], button.button, .search-button, a.button");
HB.FormButtons.disableFormButtons = function(form) {
form.find(HB.FormButtons.inputs).prop('disabled', true);
}
但是我在以下内容中调用它:
HB.PaymentDetails.deleteSavedCard = function (submittedForm) {
var cardIdToDelete = submittedForm.find('.deletedCardId').val();
$.ajax({
url: submittedForm.attr('action'),
type: 'POST',
xhrFields: {
withCredentials: true
},
beforeSend: function() {
HB.FormButtons.disableFormButtons($(HB.PaymentDetails.deleteCardFormSelector));
},
data: submittedForm.serialize()
}).done(function(){
HB.PaymentDetails.deleteSavedCardDoneHandler(cardIdToDelete);
}).fail(function(xhr){
HB.PaymentDetails.deleteSavedCardFailHandler(xhr, cardIdToDelete)
})
};
内部功能" beforeSend"没有被调用,我怎样才能使它工作,以便它也可以在ajax调用中工作?