How to alert User when the form is Submitted or Posted to Server using jQuery?
Sometimes, we require intercepting whenever a page is posted or submitted to the server. The below jQuery snippet will alert teh user with a confirm box with teh message "Are you sure to continue?" Clicking "Yes" will post the page and "No" will cancel the submit.
< head runat="server">
<title></title>
<script src="_scripts/jquery-1.3.2.min.js" type="text/javascript"></script>
<script language="javascript">
$(document).ready( function() {
$( "form").submit(function() {
return confirm('Are you sure to continue?');
});
});
</ script>
|
|