title: Display pdf blob with jquery ajax
body: <p>This is my jQuery:
      $( document ).ready(function() {
          var instrID;
          var cat;</p>
  
  <pre><code>    $(window).load(function(){
  
      });
  
              $.post('ajax.php', {InstrumentID: instrID, catView: "pdf"}, function(data){
  
              $('#displayPDF').append("&lt;php&gt; header('Content-type: application/pdf') &lt;/php&gt;");
              $('#displayPDF').append("&lt;php&gt; echo("+ data +") &lt;/php&gt;");
          });
  </code></pre>
  
  <p>This is my ajax or ajax.php:</p>
  
  <pre><code>&lt;?php
  
  include '../include/xxxxx.php';
  
  $instrumentID = $_POST['InstrumentID'];
  $category = $_POST['catView'];
  
  
  $sql = "SELECT * FROM `xxxxx` WHERE `InstrumentID` = '" . $_POST['InstrumentID'] . "'";
  
  
  $results = mysql_query($sql);
  
      if($category == "pdf")
  {
      header("Content-type: application/pdf");
      echo (mysql_result($results, 0, 'Instrument'));
  }
  ?&gt;
  </code></pre>
  
  <p>This is my div displayPDF It's empty:</p>
  
  <pre><code>&lt;div id="displayPDF"&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p>The jQuery and the div are in the same php file. I am wanting to display a pdf in the same page that the click event happens. Everything is working except for getting the pdf. When the pdf gets echoed to the div it just comes back as a bunch of characters. The pdf I am trying to display is less than 1 mb. Any ideas would be greatly appreciated. </p>