title: Reloading DataTables AJAX with Laravel
body: <p><strong>UPDATED</strong></p>
  
  <p>The idea is so that when the modal opens to create or edit a user, the validation is made and once you click submit, it'll hide the modal and refresh the datattable already on the page, which is using jquery datattabes.net. The problem is after clicking submit, nothing happens.</p>
  
  <p>Here's the info I've been using to guide myself:</p>
  
  <p><a href="http://datatables.net/reference/api/ajax.reload()" rel="nofollow">http://datatables.net/reference/api/ajax.reload()</a></p>
  
  <p><a href="http://bootstrapvalidator.com/examples/ajax-submit/" rel="nofollow">http://bootstrapvalidator.com/examples/ajax-submit/</a></p>
  
  <pre><code>&lt;script&gt;
  
  $(document).ready(function() {
  
  var oTable = $('#dataTable-users').dataTable( {
      "bProcessing": true,
      "bServerSide": true,
      "sAjaxSource": "{{ URL::to('usuarios.tabla') }}"
  })
  
  $('.editUser')
      .bootstrapValidator( {
          excluded: [':disabled', ':hidden', ':not(:visible)'],
          feedbackIcons: {
              valid: 'glyphicon glyphicon-ok',
              invalid: 'glyphicon glyphicon-remove',
              validating: 'glyphicon glyphicon-refresh'
          },
          fields: {
              first_name: {
                  validators: {
                      notEmpty: {
                          message: 'El nombre es obligatorio y no puede quedar vacio.'
                      },
                      stringLength: {
                          min: 3,
                          max: 100,
                          message: 'El nombre no puede tener menos de 3 letras.'
                      },
                      regexp: {
                          regexp: /^[a-zA-Z]+$/,
                          message: 'El nombre solo puede contener letras y espacios.'
                      }
                  }
              },
  
              last_name: {
                  validators: {
                      notEmpty: {
                          message: 'El apellido es obligatorio y no puede quedar vacio.'
                      },
                      stringLength: {
                          min: 3,
                          max: 100,
                          message: 'El apellido no puede tener menos de 3 letras.'
                      },
                      regexp: {
                          regexp: /^[a-zA-Z]+$/,
                          message: 'El apellido solo puede contener letras y espacios.'
                      }
                  }
              },
  
              email: {
                  validators: {
                      notEmpty: {
                          message: 'El email es obligatorio y no puede quedar vacio.'
                      },
                      emailAddress: {
                          message: 'La información ingresada no corresponde a un email.'
                      }
                  }
              }
          }
      })
      .on('success.form.bv', function(e) {
          // Prevent form submission
          e.preventDefault();
  
          var $form = $(e.target),                        // The form instance
              bv    = $form.data('bootstrapValidator');   // BootstrapValidator instance
  
          // Use Ajax to submit form data
          $.post($form.attr('action'), $form.serialize(), function(result) {
              $('#user-modal').modal("hide");
              oTable.ajax.url( 'http://localhost:8888/adp/usuarios.tabla' ).load();
          });
      });
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>And the view</p>
  
  <pre><code>@foreach($users as $key =&gt; $value)
  &lt;div class="modal fade edit-user-modal{{ $value-&gt;id }} user-modal" id="user-modal" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true" &gt;
      &lt;div class="modal-dialog"&gt;
          &lt;div class="modal-content"&gt;
              &lt;div class="modal-header"&gt;
                  &lt;button type="button" class="close" data-dismiss="modal" aria-hidden="true"&gt;×&lt;/button&gt;
                  &lt;h4 class="modal-title"&gt;Editando usuario &lt;strong&gt;{{ $value-&gt;username }}&lt;/strong&gt;&lt;/h4&gt;
              &lt;/div&gt;
              &lt;div class="modal-body"&gt;
  
                  {{ Form::model($value, array('route' =&gt; array('usuarios.update', $value-&gt;id), 'class' =&gt; 'editUser', 'method' =&gt; 'PUT')) }}
  
                  &lt;div class="form-group"&gt;
                      {{ Form::label('password', 'Contraseña') }}
                      {{ Form::password('password', array('class' =&gt; 'form-control')) }}
                  &lt;/div&gt;
  
                  &lt;div class="form-group"&gt;
                      {{ Form::label('first_name', 'Nombres') }}
                      {{ Form::text('first_name', Input::old('first_name'), array('class' =&gt; 'form-control')) }}
                  &lt;/div&gt;
  
                  &lt;div class="form-group"&gt;
                      {{ Form::label('last_name', 'Apellidos') }}
                      {{ Form::text('last_name', Input::old('last_name'), array('class' =&gt; 'form-control')) }}
                  &lt;/div&gt;
  
                  &lt;div class="form-group"&gt;
                      {{ Form::label('email', 'Email') }}
                      {{ Form::text('email', Input::old('email'), array('class' =&gt; 'form-control')) }}
                  &lt;/div&gt;
  
              &lt;/div&gt;
              &lt;div class="modal-footer"&gt;
                  &lt;button type="button" class="btn btn-default" data-dismiss="modal"&gt;Cerrar&lt;/button&gt;
                  &amp;nbsp;
                  {{ Form::token() }}
                  {{ Form::submit('Editar usuario', array('class' =&gt; 'btn btn-primary')) }}
                  {{ Form::close() }}
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  
  @endforeach
  </code></pre>