使用JQuery和window.print时在chrome中进行空白预览

时间:2017-07-03 11:21:38

标签: jquery

我是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);

      }
    });

0 个答案:

没有答案