Background: Its' a e learning website, when user in the learning stage, it will show content for reading at first 3 pages, and after that it will need users to do the test, when users overcome all the challenges, it will show the pdf certificate.
Currently, the problem is: after reaching the last page, it always showing me some weird words: (below is part of all)
(%PDF-1.3 3 0 obj <> endobj 4 0 obj <> stream x�3R��2�35W(�r Q�w3T04�30PISp �Z*�[����(hx����+����(j*�d��7W)
Here is the part of the code, whose file name is load_data.php
else if ($cur_page == $no_of_paginations){
ob_end_clean();
require("../fpdf.php");
$pdf = new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','B',16);
$pdf->Cell(40,10,'Hello World!');
if (preg_match("/MSIE/i", $_SERVER["HTTP_USER_AGENT"])){
header("Content-type: application/PDF");
} else {
header("Content-type: application/PDF");
header("Content-Type: application/pdf");
}
$pdf->Output();
exit;
}
Here is the ajax for pagination:
function loadData(page){
// debugger;
loading_show();
$.ajax
({
type: "POST",
url: "load_data.php",
data: { page: +page, tableName: $.urlParam('modules') },
//data: "page="+page,
success: function(msg)
{
$("#container").ajaxComplete(function(event, request, settings)
{
loading_hide();
$("#container").html(msg);
});
}
});
}
loadData(1); // For first time page load default results
$('#container .pagination li.active').live('click',function(){
var page = $(this).attr('p');
loadData(page);
})