title: Submit modal form with ajax and symfony2
body: <p>i have a modal that contains a form </p>
  
  <pre><code>    &lt;div class="modal-header"&gt;
              &lt;a href="#" class="float-right" data-placement="left" title="close" data-dismiss="modal"&gt;
                  &lt;i class="glyph-icon icon-remove"&gt;&lt;/i&gt;
              &lt;/a&gt;
          &lt;/div&gt;
  &lt;div class="modal-body"&gt;
  &lt;form id="FormInterview1" class="left-side" action="{{ path('ts_admin_HMaffectCandidate',{'id':id})}}"  method="post"{{form_enctype(form1) }}&gt;
   &lt;div class="form-row"&gt;
                  &lt;div class="form-label col-md-4"&gt;
                      &lt;label for=""&gt;
                         {{form_label(form1.evaluators)}}
                      &lt;/label&gt;
                  &lt;/div&gt;
                  &lt;div class="form-input col-md-8"&gt;
                      {{form_widget(form1.evaluators,{'attr': {'class': 'chosen-select'}})}}
                  &lt;/div&gt;
              &lt;/div&gt;           
                  &lt;div class="form-row"&gt;
                  &lt;div class="form-label col-md-4"&gt;
                      &lt;label for=""&gt;
                         {{form_label(form1.competances)}}
                      &lt;/label&gt;
                  &lt;/div&gt;
                  &lt;div class="form-input col-md-8"&gt;
                      {{form_widget(form1.competances,{'attr': {'class': 'chosen-select'}})}}
                  &lt;/div&gt;
              &lt;/div&gt;
       &lt;input type="submit" onclick="validateInterview1();" value="Submit" name="submitActionInt1" class="btn medium primary-bg" /&gt;                     
    &lt;/div&gt;
       {{ form_rest(form1) }}
  &lt;/form&gt;
  &lt;/div&gt;
  &lt;div class="modal-footer"&gt;
  
          &lt;button type="button" data-dismiss="modal" aria-hidden="true"  class="center btn medium primary-bg"&gt;Close&lt;/button&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>i use ajax to submit this modal</p>
  
  <pre><code>    &lt;script&gt;
          function validateInterview1() {
      var data = $("#FormInterview1").serialize() ;
                  $.ajax({
                          type: 'POST',
                          data: data,
                          url:$("#FormInterview1").attr('action'),
                          beforeSend: function () {
                          document.getElementById('loaderInt1').style.display = 'block';
                          },
                          success: function (data) {
                          $('#form1').html(data);
                        document.getElementById('loaderInt1').style.display = 'none';
                         },
                          error: function ()
                          {  
                          alert('Error ajax');
     document.getElementById('loaderInt1').style.display = 'none';
                          }
                  });
          }
      &lt;/script&gt;
  </code></pre>
  
  <p>in my controller i persist the new data </p>
  
  <pre><code> if ($request-&gt;getMethod() == 'POST') {
                 if ($this-&gt;getRequest()-&gt;request-&gt;get('submitActionInt1') == 'Submit') {
                  $em = $this-&gt;getDoctrine()-&gt;getManager();
                  $form1-&gt;bind($request);
                  if ($form1-&gt;isValid()) {
                  $interview1-&gt;setState(0);
                  $candidate-&gt;setInterview1($interview1);
                  $em-&gt;persist($candidate);
                  $em-&gt;flush();
                   }  
                }
                return  $this-&gt;render('TSAdminBundle:Status:FormInterview1.html.twig'
                              , array(
                          'id' =&gt; $id,
                          'form1' =&gt; $form1-&gt;createView()));
              }
  </code></pre>
  
  <p>after the persist i want to send a new html page contains the new form and display it into the modal without close the modal and without redirect me to an other url.</p>
  
  <p>this code work fine but the problem is after the submit the controller return a new page and put it in the modal but redirect me to other url.</p>