Guest User

Untitled

a guest
Nov 19th, 2018
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <title>Submit!</title>
  5. </head>
  6. <body>
  7.  
  8. <form id="PersonAdd" action="person-add.php" method="post">
  9. <input name="name" value="Bill Criswell">
  10. <input name="age" value="26">
  11. <select name="sex">
  12. <option value="male">Male</option>
  13. <option value="female">Female</option>
  14. </select>
  15. <input type="checkbox" name="attributes[]" value="Awesome"> Awesome
  16. <input type="checkbox" name="attributes[]" value="Groovy"> Groovy
  17. <input type="checkbox" name="attributes[]" value="Smelly"> Smelly
  18. <input type="submit" value="Save">
  19. </form>
  20.  
  21. <pre id="output"></pre>
  22.  
  23. <script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
  24. <script>
  25. $('#PersonAdd').submit(function(e) {
  26. var $form = $(this);
  27. $.post( $form.attr('action'), $form.serializeArray(), function( result ) {
  28. $('#output').html( result ).show();
  29. });
  30. e.preventDefault();
  31. });
  32. </script>
  33. </body>
  34. </html>
Add Comment
Please, Sign In to add comment