title: Generate report using JQuery Ajax
body: <p>Hi I have a jquery ajax receive action of the form.
  Once the data from the form I can succeed in calling laporan_per_bulan.php file which the file contains code to extract data from ajax and print reports, according to the data.</p>
  
  <p>However, the report does not appear?
  I want a report that appeared in a new tab like in Google Chrome, or downloaded directly as other browsers, when ajax call success.</p>
  
  <p>This is my ajax :</p>
  
  <pre><code>$('#save_report').click(function(e){
      ajax_cetak_laporan();
  });
  
  function ajax_cetak_laporan() {
      var bulan = $("#bulan option:selected").val();
      var kd_kelas = $("#kd_kelas option:selected").val();
      var kd_jur = $("#jur option:selected").val();
  
      $.ajax({
          type: "POST",
          dataType: "json",
          url: "../bayarspp/main/page/laporan_per_bulan.php",
          data: "{'bulan':'" + bulan+ "', 'kd_kelas':'" + kd_kelas + "', 'kd_jur':'" + kd_jur + "'}",
          success: function (html) {
              // do something here...
          }
      });
  }
  </code></pre>
  
  <p>And this my <strong>laporan_per_bulan.php</strong> file :</p>
  
  <pre><code>&lt;?php
  ...
  $bulan = $_POST['bulan']; 
  $kd_kelas = $_POST['kd_kelas']; 
  $jur = $_POST['kd_jur'];
  
  $pdf-&gt;SetFont('Arial','',10);
  $pdf-&gt;Cell(35, 0, 'Bulan');
  $pdf-&gt;Cell(5, 0, ':');
  $pdf-&gt;Cell(70, 0, $bulan);
  $pdf-&gt;Ln(4);
  
  $pdf-&gt;SetFont('Arial','',10);
  $pdf-&gt;Cell(35, 3, 'Kelas');
  $pdf-&gt;Cell(5, 3, ':');
  $pdf-&gt;Cell(70, 3, $kd_kelas);
  $pdf-&gt;Ln(10); 
  
  #output file PDF
  $pdf-&gt;Output();
  
  ?&gt;
  </code></pre>
  
  <p>Thank you.</p>