title: Laravel 5 On POST Status 302 Found
body: <p>I'm trying to create new post useing laravel , ajax and s3 , But every time i try submit the form i get Status Code:302 Found , I Hope really some help me</p>
  
  <p><strong>Firebug</strong> </p>
  
  <p><a href="http://i.stack.imgur.com/1qeHc.png" rel="noreferrer">Here in firebug result image</a></p>
  
  <p><strong>META</strong> </p>
  
  <pre><code>&lt;meta name="csrf" value="{{ csrf_token() }}"&gt;
  </code></pre>
  
  <p><strong>VIEW</strong></p>
  
  <p>The form view with csrf token </p>
  
  <pre><code>&lt;div class="col-md-8 col-md-offset-2"&gt;
                  {!! Form::open(array(
                      'class' =&gt; 'form',
                      'novalidate' =&gt; 'novalidate',
                      'files' =&gt; true
                  )) !!}
  
                  &lt;div class="form-group"&gt;
                      {!! Form::label('title', 'Title: ') !!}
                      {!! Form::text('title', null, ['class' =&gt; 'form-control']) !!}
                  &lt;/div&gt;
                  &lt;div class="form-group"&gt;
                      &lt;label for="cats"&gt;Select Category list :&lt;/label&gt;
                      &lt;select class="form-control" id="category" name="category"&gt;
                          &lt;option value=""&gt;Select Category&lt;/option&gt;
                          @foreach($category as $cat)
                              &lt;option value="{{$cat-&gt;id}}"&gt;{{$cat-&gt;name}}&lt;/option&gt;
                          @endforeach
                      &lt;/select&gt;
                  &lt;/div&gt;
                  &lt;div class="form-group"&gt;
                      &lt;label for="cats"&gt;Select Subcategory list :&lt;/label&gt;
                      &lt;select class="form-control" id="subcategory" name="subcategory"&gt;
                          &lt;option value=&gt;Select Subcategory&lt;/option&gt;
                              &lt;option value=""&gt;&lt;/option&gt;
                      &lt;/select&gt;
                  &lt;/div&gt;
                  &lt;div class="form-group"&gt;
                      {!! Form::label('image', 'Upload Image') !!}
                      {!! Form::file('image', null, ['class' =&gt; 'form-control']) !!}
                  &lt;/div&gt;
                  &lt;div class="form-group"&gt;
                      {!! Form::label('description', 'Description: ') !!}
                      {!! Form::textarea('description', null, ['class' =&gt; 'form-control']) !!}
                  &lt;/div&gt;
                  &lt;div class="form-group"&gt;
                      {!! Form::label('email', 'Your Email: ') !!}
                      {!! Form::text('email', null, ['class' =&gt; 'form-control']) !!}
                  &lt;/div&gt;
                  &lt;div class="form-group"&gt;
                      {!! Form::submit('Post Free Ad', ['class' =&gt; 'btn btn-primary form-control']) !!}
                  &lt;/div&gt;
                  {!! Form::close() !!}
              &lt;/div&gt;
  </code></pre>
  
  <p><strong>CONTROLLER</strong></p>
  
  <p>First valid the requist and than create new email for the user if he did't have and than save the post with the user</p>
  
  <pre><code>public function storePostAds(Request $request)
      {
          $this-&gt;validate($request, [
             'title' =&gt; 'required',
             'description' =&gt; 'required',
             'image' =&gt; 'required',
             'category_id' =&gt; 'required',
             'subcategory_id' =&gt; 'required',
          ]);
          $email = $request['email'];
          $title = $request['title'];
          $description = $request['description'];
          $category = $request['category_id'];
          $subcategory = $request['subcategory_id'];
          $image = $request-&gt;file('image');
          $user = User::where('email', $email)-&gt;first();
          if(!$user){
              $user = new User();
              $user-&gt;email = $email;
              $user-&gt;save();
          }
          if($image-&gt;isValid()){
              $name = $image-&gt;getClientOriginalName();
              $key = 'images/'.$name;
              Storage::disk('s3')-&gt;put($key, file_get_contents($image));
          }
          $post = new Post();
          $post-&gt;title = $title;
          $post-&gt;description = $description;
          $post-&gt;category_id = $category;
          $post-&gt;subcategory_id = $subcategory;
          $post-&gt;image = $image;
          $user-&gt;posts()-&gt;save($post);
          return redirect('/');
      }
  </code></pre>
  
  <p><strong>Ajax</strong></p>
  
  <p>ajax to get subcategory foreach category after select</p>
  
  <pre><code>(function($){
      $('#category').on('change', function(e){
  
          var cat_id = e.target.value;
          $.get('/ajax-subcategory?cat_id=' + cat_id, function(data){
              var subcategory = $('#subcategory');
              subcategory.empty();
              $.each(data, function(index, subcatObj){
                 subcategory.append('&lt;option value="'+subcatObj.id+'"&gt;'+subcatObj.name+'&lt;/option&gt;');
              });
          });
      });
  }(jQuery));
  </code></pre>