Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 打印函数停止jquerypost_Javascript_Jquery_Codeigniter_Http Post - Fatal编程技术网

Javascript 打印函数停止jquerypost

Javascript 打印函数停止jquerypost,javascript,jquery,codeigniter,http-post,Javascript,Jquery,Codeigniter,Http Post,我正在使用codeigniter开发一个web应用程序。我正在使用jquery post函数向控制器发帖,在下一行中,我将调用一个print函数。当我评论这个打印函数时,jquery post可以正常工作,但是jquery post不能正常工作 我在chrome中遇到此错误:请求头警告显示临时头 我的代码: $.post("<?=base_url()?>appointments/getAppointmentCount", {'customer_code':customer_code

我正在使用codeigniter开发一个web应用程序。我正在使用jquery post函数向控制器发帖,在下一行中,我将调用一个print函数。当我评论这个打印函数时,jquery post可以正常工作,但是jquery post不能正常工作

我在chrome中遇到此错误:请求头警告显示临时头

我的代码:

$.post("<?=base_url()?>appointments/getAppointmentCount",  {'customer_code':customer_code}, function(data) {
alert("");
var appoCountObj = JSON.parse(data);
console.log(appoCountObj);
printbill();
});

function printbill()
{
/*print bill in popup*/
var printContent = $("#PreviewBillModal .modal-body").html();
var myWindow=window.open('', 'PrintWindow',   'width=950,height=850,top=50,left=50,toolbars=no,scrollbars=yes,status=no,resizable=yes,minimizable=no');
myWindow.document.writeln('<!DOCTYPE html>');
myWindow.document.writeln('<html><head><title></title>');
myWindow.document.writeln("<link rel='stylesheet' type='text/css' href='<?=base_url()?>css/style.css' />");
myWindow.document.writeln('</head><body>')
myWindow.document.write(printContent);
myWindow.document.writeln('</body></html>');

myWindow.document.close();
myWindow.focus();
myWindow.print();
myWindow.close();
}
$.post(“约会/getAppointmentCount”,{'customer\u code':customer\u code},函数(数据){
警报(“”);
var appoCountObj=JSON.parse(数据);
控制台日志(appoCountObj);
打印账单();
});
函数printbill()
{
/*在弹出窗口中打印账单*/
var printContent=$(“#previewbillmodel.modal body”).html();
var myWindow=window.open(“”,'PrintWindow','width=950,height=850,top=50,left=50,toolbars=no,scrollbars=yes,status=no,resizeable=yes,minimizeable=no');
myWindow.document.writeln(“”);
myWindow.document.writeln(“”);

myWindow.document.writeln(“这是因为打印对话框暂停post。请尝试设置一个小延迟:

setTimeout(function() {      
  printbill();
},100);

当使用未打印进行此操作时,请求上的http状态代码是什么?您看到的错误通常与服务器端错误有关,而不是与客户端错误有关。使用注释am获取状态200,使用注释am获取无状态代码,amm获取此错误“显示请求标头警告临时标头”。