我是JQuery的新手,我正在使用Window.Print功能,但它在chrome中显示空白预览。这是我的示例代码:任何想法我在代码中做错了什么?
jQuery.ajax({
type: "POST",
async: false,
url: "<?php echo base_url(); ?>" + "index/print",
dataType: 'text',
data:data,
success: function(res) {
var w = window.open(document.URL, '_blank', "location=No,height=1000,width=700,scrollbars=yes,status=yes" );
w.document.write(res);
alert(res);
w.print();
setTimeout(function(){w.close();}, 2);
}
});