title: Laravel upload form returning json
body: <p>i'm still beginner in laravel and stuck with that upload ajax form : it's still sending a json response displayed in the browser instead of staying on the current page as i expect.
  I just want to get a json response i could use on current page.</p>
  
  <p><strong>Here is my view</strong></p>
  
  <pre><code>&lt;form action="/Project/UploadDocumentProject" enctype="multipart/form-data"  method="post"  id ="form0"&gt;
  
      {{ csrf_field() }}
  
      &lt;input id="ProjectID" name="ProjectID" type="hidden" value="{{$Project-&gt;id}}"&gt;
  
      &lt;div class="form-group"&gt;
          &lt;input name="DocumentFile" id="DocumentFile" class="form-control" type="file" &gt;
      &lt;/div&gt;
  
  
      &lt;div class="form-group"&gt;
          &lt;button id ="test" class="btn btn-success upload-image" type="submit"&gt;Upload&lt;/button&gt;
      &lt;/div&gt;
  
  &lt;/form&gt;
  </code></pre>
  
  <p><strong>Here is my ajax request</strong></p>
  
  <pre><code>$('#form0').on("submit", function(e){
      e.preventDefault();
      $(this).ajaxForm(options);
  
      var options = { 
          complete: function(response) 
          {
              if($.isEmptyObject(response.responseJSON.error)){
                  $("input[name='DocumentFile']").val('');
                  alert('Image Upload Successfully.');
              }else{
                  printErrorMsg(response.responseJSON.error);
              }
          }
      };
  </code></pre>
  
  <p>});</p>
  
  <p><strong>Here is my controller</strong></p>
  
  <pre><code>public function UploadDocumentProject (Request $Request)
  {
      $ProjectID=$Request-&gt;get('ProjectID');
      $filename = $Request-&gt;DocumentFile-&gt;getClientOriginalName();
  
      $Request-&gt;DocumentFile-&gt;storeAs('/public/projects/'.$ProjectID.'/files',$filename);
  
      return response()-&gt;json(['success'=&gt;'done']);
  
  }
  </code></pre>
  
  <p><strong>Here is my route</strong></p>
  
  <pre><code>Route::post('/Project/UploadDocumentProject','ProjectController@UploadDocumentProject');
  </code></pre>
  
  <p>I have already tried to specify data-ajax="true" data-ajax-method="POST" in my form, but then request does not take file input into account even when specifying data field in my ajax request. 
  Could anyone help me ? </p>
  
  <p>Thanks! :)</p>