title: showing pdf in browser tab through ajax
body: <p>I have used <a href="http://johnculviner.com/jquery-file-download-plugin-for-ajax-like-feature-rich-file-downloads/" rel="nofollow"><strong>jquery.fileDownload</strong></a>  and Spring for downloading .pdf files through Ajax.</p>
  
  <p>The application is working fine and the pdf is downloading successfully. The problem is that Instead of downloading I want the pdf to be opened within a new Browser Tab.</p>
  
  <p>Can anyone please tell me some solution for this</p>
  
  <h2>Server Side</h2>
  
  <p>I am using Spring at the server side</p>
  
  <pre><code>@RequestMapping(value = "exportPDF", method = RequestMethod.POST, produces = APP_JSON)
  @ResponseBody
  public void getPDF(final HttpServletResponse response, @RequestParam(value = "empId", required = true) final String empId) throws IOException, Exception
  {
      final byte[] pdf= ExportPDFUtil.getFileBytes(empId); // get the file bytes
      final OutputStream output = getOutputStream(response);
      response.setHeader("Content-Disposition", "attachment; filename=documents_" + new DateTime() + ".pdf");
      response.setContentType(CONTENT_TYPE);
      response.setContentLength(pdf.length);
      write(output, pdf);
  }
  </code></pre>
  
  <h2>Client Side</h2>
  
  <p>At the client side, I am using AngularJS</p>
  
  <pre><code>$downloadXLS = function(id)
  {
      $.fileDownload('/user/exportPDF', 
      {
          httpMethod : "POST",
          data : {
              empId : id
          }
      }).done(function(e, response)
      {
       // success
      }).fail(function(e, response)
      {
       // failure
      });
  }
  </code></pre>