1The form is submitting after the ajax request.
2
3<html>
4 <head>
5 <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
6 <script>
7 $(function () {
8
9 $('form').on('submit', function (e) {
10
11 e.preventDefault();
12
13 $.ajax({
14 type: 'post',
15 url: 'post.php',
16 data: $('form').serialize(),
17 success: function () {
18 alert('form was submitted');
19 }
20 });
21
22 });
23
24 });
25 </script>
26 </head>
27 <body>
28 <form>
29 <input name="time" value="00:00:00.00"><br>
30 <input name="date" value="0000-00-00"><br>
31 <input name="submit" type="submit" value="Submit">
32 </form>
33 </body>
34</html>