-1

我正在尝试重置按钮标签的文本。当用户单击按钮时,会进行 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
4

1 回答 1

0

我最终使用了 .ajax() 方法。有更多的控制权。

http://api.jquery.com/jQuery.ajax/

于 2012-09-13T01:25:20.090 回答