Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!doctype html>
- <html lang="en">
- <head>
- <title>Submit!</title>
- </head>
- <body>
- <form id="PersonAdd" action="person-add.php" method="post">
- <input name="name" value="Bill Criswell">
- <input name="age" value="26">
- <select name="sex">
- <option value="male">Male</option>
- <option value="female">Female</option>
- </select>
- <input type="checkbox" name="attributes[]" value="Awesome"> Awesome
- <input type="checkbox" name="attributes[]" value="Groovy"> Groovy
- <input type="checkbox" name="attributes[]" value="Smelly"> Smelly
- <input type="submit" value="Save">
- </form>
- <pre id="output"></pre>
- <script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
- <script>
- $('#PersonAdd').submit(function(e) {
- var $form = $(this);
- $.post( $form.attr('action'), $form.serializeArray(), function( result ) {
- $('#output').html( result ).show();
- });
- e.preventDefault();
- });
- </script>
- </body>
- </html>
Add Comment
Please, Sign In to add comment