0
我需要你的帮助或来自输出文件pdf与jQuery的建议。我有输出文件的问题,因为pdf文件没有出来。这个脚本jQuery和HTML:用Jquery输出文件PDF
<script>
$("#msg").hide();
$("button").click(function() {
var subject = $("#subject").val();
var client = $("#client").val();
$.ajax ({
url: "http://localhost/report/fpdf_report.php",
type: "POST",
data: { subject: subject, client: client },
success: function(data) {
$("#msg").html(data);
$("#msg").fadeIn("slow").delay(2000);
},
error: function(xhr) {
alert(xhr+"error");
}
});
});
</script>
<input type="text" id="subject" /> <input type="text" id="client" /> <input type="text" id="client" /> <button>PDF</button> <br /> <div id="msg"></div>
所以对于PHP脚本转换PDF:
<?php
$subject = $_POST['subject'];
$client = $_POST['client'];
require ('fpdf/fpdf.php');
$pdf = new FPDF();
$pdf -> AddPage();
$pdf -> SetFont('Arial','B',20);
$pdf -> Cell(40,10,$subject);
$pdf -> Cell(50,20,$client);
$pdf -> Output();
?>
亲爱的Tenhsor,感谢您的帮助:D – akashi 2014-10-09 13:05:11