javascript - Print function stops jquery post -
javascript - Print function stops jquery post -
i working on web application in codeigniter. posting controller using jquery post function , in next line calling print function. when comment print function jquery post working fine, otherwise jquery post not working.
am getting error in chrome : request headers caution provisional headers shown
my code:
$.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(); }
please help, thanks
that's because print dialog stalls post. seek setting minor delay:
settimeout(function() { printbill(); },100);
javascript jquery codeigniter http-post
Comments
Post a Comment