How can I disable a button after it has been clicked. And let it remain disabled. I tried using .prop('disabled', true);
although it disables the button, however when i refresh the page then button became clickable again. Also if I have a list of it, it would disable other button as well which I do not want. Is there anyway to do it?
<table>
<tr>
<td id="milestone_1">
</td>
<td id="percentage_1">
</td>
<td>
<form id="pay1">
<input type="hidden" class="id_hidden" name="id_hidden">
<input type="hidden" class="paid_hidden" name="paid_hidden">
<input type="hidden" class="budget_hidden" name="budget">
<input type="hidden" id="percent1" name="percent">
<input type="submit" name="pay1" value="Pay">
</form>
</td>
</tr>
<tr>
<td id="milestone_2">
</td>
<td id="percentage_2">
</td>
<td>
<form id="pay2">
<input type="hidden" class="id_hidden" name="id_hidden">
<input type="hidden" class="paid_hidden" name="paid_hidden">
<input type="hidden" class="budget_hidden" name="budget">
<input type="hidden" id="percent2" name="percent">
<input type="submit" name="pay2" value="Pay">
</form>
</td>
</tr>
<tr>
<td id="milestone_3">
</td>
<td id="percentage_3">
</td>
<td>
<form id="pay3">
<input type="hidden" class="id_hidden" name="id_hidden">
<input type="hidden" class="paid_hidden" name="paid_hidden">
<input type="hidden" class="budget_hidden" name="budget">
<input type="hidden" id="percent3" name="percent">
<input type="submit" name="pay3" value="Pay">
</form>
</td>
</tr>
</table>
$("#pay1").submit(function(){
$.ajax({
type: "GET",
url: "pay.php",
data: $("#pay1").serialize(),
success: function(data){
$("#add_success").html(data);
$("#add_err").html("");
}
});
return false
});
$("#pay2").submit(function(){
$.ajax({
type: "GET",
url: "pay.php",
data: $("#pay2").serialize(),
success: function(data){
$("#add_success").html(data);
$("#add_err").html("");
}
});
return false
});
$("#pay3").submit(function(){
$.ajax({
type: "GET",
url: "pay.php",
data: $("#pay3").serialize(),
success: function(data){
$("#add_success").html(data);
$("#add_err").html("");
}
});
return false
});