title: Laravel how to redirect back to boostrap modal dialog window
body: <p>I want to return to my modal dialog edit form to show validation errors but using <code>Redirect::back</code> I just end up at the HTML page without the modal window. </p>
  
  <p>I use <a href="http://nakupanda.github.io/bootstrap3-dialog/" rel="noreferrer">BootstrapDialog</a>  to load my <code>attendee.edit</code> route into a modal dialog to that pops up an edit form. </p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;td&gt;{{link_to_route('attendee.edit','',array($attendee-&gt;id), array(
          'class'=&gt;'edit-attendee btn btn-info btn-xs glyphicon glyphicon-pencil',
          'data-title' =&gt; 'Edit Attendee'))}} 
  &lt;/td&gt;
  </code></pre>
  
  <p><strong>JQuery call to BootstrapDialog</strong></p>
  
  <pre><code>$(document).ready(function(){
      $('.btn.edit-attendee').click(function(e){
          e.preventDefault();
          url = $(this).attr('href');
          BootstrapDialog.show({
              title: $(this).data('title'),
              message: $('&lt;div&gt;&lt;/div&gt;').load(url),
              buttons: [{
                  label: 'Update',
                  action: function(dialogRef) {
                      $('form').submit();
                  }
              }]
          });
      });
  });
  </code></pre>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>public function update($id)
  {
      $attendee = Attendee::findOrFail($id);
  
      $validator = Validator::make($data = Input::all(), Attendee::$rules);
  
      if ($validator-&gt;fails())
      {
          return Redirect::back()-&gt;withErrors($validator)-&gt;withInput();
      }
  
      $attendee-&gt;update($data);
  
      return Redirect::route('attendees.index');
  }
  </code></pre>
  
  <p>After I edit the form I want to return to the modal window to display validation errors but I just end up at the HTML page without the dialog. How do I redirect back to the modal window?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p><strong>added <code>id</code> to controller return</strong></p>
  
  <pre><code>return Redirect::back()-&gt;withErrors($validator)-&gt;withInput()-&gt;with('id', $id);
  </code></pre>
  
  <p><strong>Added Jquery</strong></p>
  
  <pre><code>  @if(!empty(Session::get('id')))
  
      $(document).ready(function(){
              url = "{{ URL('attendee') . '/' . Session::get('id'). '/edit' }}";
              BootstrapDialog.show({
                  title: $(this).data('title'),
                  message: $('&lt;div&gt;&lt;/div&gt;').load(url),
                  buttons: [{
                      label: 'Update',
                      action: function(dialogRef) {
                          $('form').submit();
                      }
                  }]
              });
      });
  
      @endif
  </code></pre>
  
  <p>This reopens the modal window if there was an error but proceeds back if not. I don't like how it closes and reopens the modal and the validation errors are not passed to the modal so I would not recommend doing it this way. </p>