印刷機能を使用できます。コード以下のような :
$('#print').on('click', function(){
var id = $('#id').val();
$.post("print_invoice.php", { ref: id },function(data){
printdoc("Print Title","style.css",data);
});
});
function printdoc(wintitle,style,content){
var mywindow = window.open('',wintitle, 'height=600,width=1000');
mywindow.document.write('<html><head><title>'+wintitle+'</title>');
mywindow.document.write('<link href="'+style+'" rel="stylesheet" type="text/css" />');
mywindow.document.write('</head><body>');
mywindow.document.write(content);
mywindow.document.write('</body></html>');
mywindow.document.close();
mywindow.print();
}
データは、その後
function printdoc(wintitle,style,content){
var mywindow = window.open('',wintitle, 'height=600,width=1000');
mywindow.document.write(content);
mywindow.document.close();
mywindow.print();
}
ウィンドウをフルデザインのページを持っている場合は、開いているが、内容はあなたがここに$ .postの応答を書くことができ、印刷ウィンドウ – Naresh
への書き込みをされていません。私がテストしたコードの上にbcozとその動作。それで、あなたが 'データ 'に入っているものを確認するだけでいいです – Veer