title: Display pdf in browser with jquery
body: <p>PHP code generates pdf content(using mpdf).I need to display it in browser using js (ajax request gets this pdf content as string). How can I do this?</p>
  
  <p>PHP:</p>
  
  <pre><code>$data['content'] = utf8_encode($this-&gt;_getViewPDF($data['content']));
  </code></pre>
  
  <p>JS:</p>
  
  <pre><code>var jsonString = utf8_decode(data.content);
  var template = "&lt;object type='application/pdf' data= '" + jsonString + "'&gt;";
  var windowPrint,
  objBrowse = window.navigator;
  
  windowPrint = window.open('', '_blank');
  
  windowPrint.document.write(template);
  windowPrint.document.close();
  windowPrint.focus();
  </code></pre>
  
  <p>But browser displays only pdf code</p>