发布后用Jquery更改按钮上的文本

Tex*_*tus 2 ajax jquery

我使用ajax发布一些数据,并希望更改按钮文本.我真的不知道从哪里开始.我到目前为止的代码如下:

$("input[type='button'][name='Subscribe']").click(function(e){
$.ajax({
   type: "POST",
   url: "test.php",
   data:{
    id: $(this).attr('id'),
    idMembers: $(this).attr('idMembers')
    },
   success: function(msg){
       alert("Subscribed");

   }
})
});
Run Code Online (Sandbox Code Playgroud)

ros*_*lan 7

$("input[type='button'][name='Subscribe']").click(function(e){
$this = $(this);
$this.val("processing") // or: this.value = "processing";  
$this.prop('disabled', true); // no double submit ;)
$.ajax({
   type: "POST",
   url: "test.php",
   data:{
    id: $this.attr('id'),
    idMembers: $this.attr('idMembers')
    },
   success: function(msg){
       alert("Subscribed");
       $this.val("i'm finally done!"); // pfewww, that's was hard work!
   }
})
});
Run Code Online (Sandbox Code Playgroud)