Watch this example on YouTube
1. View
@{
ViewBag.Title = "Home Page";
}
<input type="submit" value="SUBMIT" />
<input type="submit" value="CANCEL" />
@section Scripts{
<script type="text/javascript">
$(document).ready(function () {
var clickNum = 0;
jQuery('input[type=submit]').click(function (event) {
if (this.value == 'CANCEL') {
clickNum = 0;
return false;
}
if (clickNum > 0) {
alert("Wait!!!!!");
return false;
}
else {
clickNum++;
}
});
});
</script>
}
2. Controller
public ActionResult Index(){
return View();
}
[HttpPost]
public ActionResult Index(string test = "")
{
System.Timers.Timer t = new System.Timers.Timer(2000);
return View();
}
No comments:
Post a Comment