如何将window.print html与ajax结合使用?
在我的成功回调
,
success(data){
//how to print the html in a new page?
}
我试过
var invoice = window.open(data, '_blank');
setTimeout(invoice.print(), 5);
setTimeout
采用未执行的函数(不带括号)或Anonymous函数。无论如何,我都会这么做:
var invoice = open(data);
invoice.onload = function(){
this.print();
}