Created
May 13, 2011 07:04
-
-
Save mgallego/970111 to your computer and use it in GitHub Desktop.
paso de form con Ajax
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //esto supongo que está pendiente del DOM, por que pone document :) | |
| $(document).ready(function() { | |
| //esto detecta cuando el form con id="upload_form" hace submit | |
| $('#upload_form').submit(function(){ | |
| //con esto hago el paso | |
| $.ajax({ | |
| type: 'POST', | |
| //saca la url del parametro "action" del form, que es /img/upload | |
| url: $(this).attr('action'), | |
| //coge los datos del form | |
| data: $(this).serialize(), | |
| //si todo ha salido bien cierra el fancybox | |
| success: function(data) { | |
| parent.$.fancybox.close(); | |
| } | |
| }); | |
| return false; | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment