Ver Mensaje Individual
  #2 (permalink)  
Antiguo 01/10/2015, 19:09
Montes28
 
Fecha de Ingreso: septiembre-2010
Mensajes: 1.853
Antigüedad: 13 años, 7 meses
Puntos: 6
Respuesta: Es posible enviar mediante ajax un array de campo

lo solucione de esta manera, es posible mejoralo?

Código Javascript:
Ver original
  1. $(document).ready(function() {
  2.  
  3.     $('#save').click(function(e){
  4.          var fc = $('input[name="fc[]"]').map(function(){
  5.                     return this.value;
  6.                 }).get();
  7.  
  8.          var azimut = $('input[name="azimut[]"]').map(function(){
  9.                     return this.value;
  10.                 }).get();
  11.  
  12.          var Incidencia = $('input[name="Incidencia[]"]').map(function(){
  13.                     return this.value;
  14.                 }).get();
  15.  
  16.  
  17.           $.ajax({
  18.         headers: {
  19.             'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
  20.         },
  21.                     type: 'POST',
  22.                     url: 'pruebaAjax',
  23.                     data: {
  24.                         'fc[]': fc,
  25.                         'azimut[]':azimut,
  26.                         'Incidencia[]':Incidencia
  27.                         // other data
  28.                     },
  29.                     success: function() {
  30.  
  31.                     }
  32.                 });
  33.     });
  34.  
  35. });