Here is the code. “core/bcsheet.php” returns PDF document but ajax shows as html code. How can I show PDF to user?
function ajaxPost() {
form = $("#dbview");
formData = form.serialize();
formUrl = "core/bcsheet.php";
formMethod = form.attr('method');
$.ajax({
url: formUrl,
type: formMethod,
dataType: "html",
cache: false,
data: formData,
success: function (html) {
var win = window.open('', 'childWindow', 'location=yes, menubar=yes, toolbar=yes');
win.document.open();
win.document.write(html);
// win.print();
win.document.close();
//win.close();
}
});
};
I would open the URL in a new window and add the script a pdf header while streaming the content via
print().http://php.net/manual/de/function.header.php