I am posting some data using ajax and want to change the button text. I don't really know where to start. The code I have so far is below:
$("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");
}
})
});
$("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!
}
})
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With