蓝牙快速打印机脚本为何会阻止页面执行完成

时间:2019-04-22 22:28:59

标签: javascript php html bluetooth

以下代码可以通过sendToQuickPrinter函数完美地打印到蓝牙打印机,但是该页面未运行其下面的PHP脚本。当打印机完成打印后,我需要页面执行php脚本来调用其他页面。谢谢

<script>
function sendToQuickPrinter(){
var text =
"<CENTER><MEDIUM2><?php echo $shop_name ?><BR>" +
"<CENTER><?php echo $display_date ?>        <?php echo $display_time ? 
<BR><BR>" +
"Description          Price<BR>" +
"<?php $i=0;while($i < $print_count){$i=$i+1; echo 
$p_name_array[$i].';; ;;'.$transaction_qty_array[$i].' @ 
'.number_format($p_price_array[$i],2).'<BR>';} ?>" +
"<BR>" +
"<CENTER>Sub-total      $<?php echo number_format($subtotal,2) ?><BR>" 
+
"<CENTER>Tax            $<?php echo number_format($subtax,2) ?><BR>" +
"<CENTER>Total          $<?php echo number_format($item_total,2) ?> 
<BR>" +
"<BR>" +
"<CENTER>Thank you for shopping with us, we appreciate your business! 
<BR>" +
"<CENTER><MEDIUM2> Have a great day!<BR>" +
"<BR>" +
"<CUT>" +
"DRAWER";
var textEncoded = encodeURI(text);
window.location.href="quickprinter://"+textEncoded;
}
sendToQuickPrinter();
</script>

<?php
$path = "cart.php";

function success_return($path, $shop_name, $longitude, $latitude) {  
    include($path);
}  

success_return($path, $shop_name, $longitude, $latitude);
exit;
?>

0 个答案:

没有答案