Advertisement
Guest User

HTML + AJAX

a guest
Feb 8th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.69 KB | None | 0 0
  1. <html>
  2.   <head>
  3.     <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
  4.     <script>
  5.       $(function () {
  6.  
  7.         $('form').on('submit', function (e) {
  8.  
  9.           e.preventDefault();
  10.  
  11.           $.ajax({
  12.             type: 'post',
  13.             url: 'post.php',
  14.             data: $('form').serialize(),
  15.             success: function () {
  16.               alert('form was submitted');
  17.             }
  18.           });
  19.  
  20.         });
  21.  
  22.       });
  23.     </script>
  24.   </head>
  25.   <body>
  26.     <form>
  27.       <input name="time" value="00:00:00.00"><br>
  28.       <input name="date" value="0000-00-00"><br>
  29.       <input name="submit" type="submit" value="Submit">
  30.     </form>
  31.   </body>
  32. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement