我正在尝试重置按钮标签的文本。当用户单击按钮时,会进行 ajax 调用,然后将按钮的标题更改为响应消息(成功或失败),如果他们想要进行更多更改,我需要将其更改回 Save。现在它只停留在响应消息上
// SAVE NEW STUDENT DETAILS
$('#save_student_detail_changes').live('click',function(){
$('#save_student_detail_changes').text('Save');
var changes ='&';
// FIND ALL THE INPUT CHILDREN OF #STUDENT_DETAILS AND INSERT THE VALUE ATTRIBUTE AND THE COL ATTRIBUTE INTO THEIR OWN VARIABLES
$('#student_details').find("input").each(function() {
var value = $(this).attr('value');// VARIABLE FOR VALUE ATTRIBUTE OF INPUT TAG
var column = $(this).attr('col');// VARIABLE FOR COL ATTRIBUTE OF INPUT TAG
changes += column + '=' + value + '&' ;// BUILDS THE AJAX QUERY STRING
var lin = $(this).parent().attr('rel');// GET ID ATTRIBUTE DETAILS
$(this).parent().attr('id',lin);// MAKE NEW ATTRIBUTE WITH DETAILS FROM ID ATTRIBUTE
$(this).parent().removeAttr('rel');// REMOVE ID ATTRIBUTE
$(this).replaceWith(value); // REPLACE INPUT ELEMENT WITH VALUE THAT WAS INSERTED
});
$(this) // AJAX CALL
.html(ajax_load) // SHOW LOADING SPINNING WHEEL
.load(loadUrl,"form_being_submitted=save_student_detail_changes"+changes);
$(this).fadeOut(3000);// FADE OUT SAVE BUTTON