[英]How can I pass data from $.post request to a file and print
in my code I use a $.post request and I get some data back. 在我的代码中,我使用了$ .post请求,并获得了一些数据。 I want these data printed (on paper!).
我希望将这些数据打印在纸上! My code in javascript is:
我在javascript中的代码是:
$('#printDamages').click(function(){
var printDmgs = [];
$.each($("input[name='chk_group']:checked"), function(){
printDmgs.push($(this).val());
});
$.post('ajax_Print_Damages.php',
{
inner : JSON.stringify(printDmgs)
},
function(data){
window.print(); //I tried this but ofcourse is printing current window
}
);
});
Has anyone something to suggest? 有没有人建议?
function(data){
var newWindow = window.open('','','width=200,height=200');
newWindow.document.write(data);
newWindow.print();
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.