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 SMSa>
- 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);
- });

Suraj KumarRank #353 · 7.1K reputationPosted Oct 15, 2018, 2:42 AM EDT
Sumit ChaudharyRank #3,483 · 416 reputationPosted Oct 15, 2018, 2:49 AM EDT
Yasin Kızıltaş52 reputationPosted Oct 15, 2018, 3:08 AM EDT
Yasin Kızıltaş52 reputationPosted Oct 15, 2018, 3:11 AM EDT
Vincent Maverick DuranoRank #238 · 10.3K reputationPosted Oct 15, 2018, 6:25 AM EDT
Yasin Kızıltaş52 reputationPosted Oct 15, 2018, 10:44 PM EDT
Vincent Maverick DuranoRank #238 · 10.3K reputationPosted Oct 16, 2018, 5:11 AM EDT