i am working with phalcon php framework. I want to send data displayed in a div tag(it is a result of a search)to controller function, and controller will generate pdf file. But, pdf file is not generating. Here is my view:
var imenica = "Ja se zovem Nedim Omerbegovic";
$.ajax({
url: '<?php echo $this->url->get("test/creatingpdf");?>',
type: 'POST',
dataType: '',
data: {imenica:imenica},
success: function(data){
alert(data);
} ,
error: function(){
alert("Greska");
}
});
});
and here is code for controller:
public function creatingpdfAction(){
$this->view->disable();
$string =$_POST['imenica'];
$this->view->setVars(array('ime'=>$string));
$loader = new \Phalcon\Loader();
$loader->registerClasses(
array(
"mpdf"=> "C:/wamp/www/phalcon1/mpdf/mpdf.php"
)
);
$loader->register();
//$string = "Ja se zovem Nedim Omerbegovic";
$view = new \Phalcon\Mvc\View();
$view->setViewsDir('../app/views/');
$cont = $this->view->getRender('test', 'creatingpdf');
//generisanje pdf dokumenta
$pdf = new mpdf();
$pdf->WriteHTML($cont, 2);
$br = rand(0,100000);
$ispis = "Pobjeda Rudet-Izvjestaj-".$br;
$pdf->Output($ispis, 'I');
}
How can i see generated pdf file in this way of warking