Ver Mensaje Individual
  #2 (permalink)  
Antiguo 14/05/2012, 16:53
Avatar de Naahuel
Naahuel
 
Fecha de Ingreso: marzo-2011
Ubicación: localhost
Mensajes: 796
Antigüedad: 13 años, 1 mes
Puntos: 192
Respuesta: Pasar datos por POST con Ajax en un Modal Form (Jquery)

Supongo que algo así funcionaría:

Código Javascript:
Ver original
  1. $( "#categ-form" ).dialog({
  2.     autoOpen: false,
  3.     height: 200,
  4.     width: 300,
  5.     modal: true,
  6.     buttons: {
  7.         "Crear Categoria": function(){
  8.             // enviar formulario por ajax
  9.            
  10.             var $elem = $(this);
  11.             var $form = $('#id-formulario-u-otro-selector');
  12.            
  13.             $form.submit(function(e){
  14.                 e.preventDefault();
  15.                 var valores = $(this).serialize();
  16.                 var _url = $(this).attr('action');
  17.                 var $envio = $.ajax({
  18.                     url: _url,
  19.                     data: values,
  20.                     type: 'POST'
  21.                 });
  22.                
  23.                 //cuando el envio finalice:
  24.                 $envio.done(function(){
  25.                     //Cerrar el dialogo (o hacer otra cosa)
  26.                     $elem.dialog( 'close' );
  27.                 });
  28.             });
  29.            
  30.            
  31.         },
  32.         "Cancelar": function() {
  33.             $( this ).dialog( 'close' );
  34.         }
  35.     },
  36. });

Cambiá el id del formulario por un selector correcto.
__________________
nahueljose.com.ar