I have a button that will execute a stored procedure. After it's been clicked, I want it disabled so that the user can't click it multiple times. However, once it's been clicked, I also want to run some C# on the server side through an onclick event. As of right now, all my code does is disable the button, but then it won't run the server side stuff. Can this be achieved? Here's my jQuery:
$("#btnGenerate").click(function () {
$(this).attr("disabled", true).val("Generating...");
});
You can make an ajax call to the server just after you hide/disable the button.
You can do something like this:
$("#btnGenerate").click(function () {
$(this).attr("disabled", true).val("Generating...");
// an ajax call to the server to call the stored procedure
$.ajax({
url: "CallStoredProcedure.aspx",
context: $("#value"),
success: function(){
$(this).val("done!");
}});
}
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