Ver Mensaje Individual
  #6 (permalink)  
Antiguo 20/02/2015, 06:36
Avatar de GeekGirl
GeekGirl
 
Fecha de Ingreso: julio-2014
Mensajes: 423
Antigüedad: 9 años, 10 meses
Puntos: 44
Respuesta: JSON response

Tengo mis dudas de que ese ajaxForm esté funcionando correctamente.
Por qué no asociás un AJAX común de jQuery al submit() de tu formulario o si el input no es de tipo submit a click()?

Código Javascript:
Ver original
  1. $('#botonForm').click(function() {
  2. // $(#tuForm).submit(function() { De usar el submit tenés que usar un preventDefault para evitar el envío del form  
  3.   $.ajax({
  4.       type: "POST",
  5.       url: rutaATuArchivoQueProcesaElForm.php,
  6.       data: dataDelFormulario,
  7.       dataType: "json",
  8.       success: function (response) {
  9.         var parsed = $.parseJSON(response);
  10.  
  11.         if (parsed.status=="True") {
  12.           alert("Eliminado!");
  13.           var idProd = response.product_id;
  14.           var elementos= $(nombre_tabla+' >tbody >tr').length;
  15.  
  16.           if (elementos==1) {
  17.             location.reload();
  18.           } else {
  19.             $('#tr'+idProd).remove();
  20.             $(nombre_ventana_modal).modal('hide');
  21.           }
  22.         } else {
  23.           alert("Hubo un error al eliminar!");
  24.           $(nombre_ventana_modal).modal('hide');
  25.         }
  26.       }
  27.   });
  28. });