I have a button on my update page. This button redirects and refreshes the page after sending sms
I want that;
If the user pushes the button and sends sms 1 time, do not press the same button 2 times unless the page is closed.
In fact, I installed the structure, but because the button response is redirect, my page refreshes every time and never falls into the following else. How can I solve this?
Response redirect(in controller)
- public void SMSGonder(int flowId)
- {
- flow flow = db.flow.Find(flowId);
- string meetingDate = "";
- foreach (var item in db.sp_get_meeting(flowId))
- {
- meetingDate = item.meetingDate.ToString("dd.MM.yyyy HH:mm");
- }
- DakikSMSMesajGonder2(flow.flowPhone.ToString(), flow.flowName, meetingDate, null);
- Response.Redirect("~/flows/Edit?id=" + flowId);
- }
href button;
- <div class="col-md-4">
- <a class="btn btn-default" id="sms" href="/flows/[email protected]">Sent SMS</a>
- </div>
and JQuery;
- $("#sms").click(function () {
- var $foo = $(this);
- if(!$foo.data('clicked'))
- {
- alert("SMS sent successfully!");
- }
- else {
- alert("You've already sent this sms.");
- }
- $foo.data('clicked', true);
- });