我正在尝试将javascript函数中的链接与php变量连接起来。但无论在“+”之后尝试写什么都没有显示,整个程序停止工作。变量在不同的页面中定义。我试过REQUEST来访问它,但它没有用。
function popupEvent(){
$('#btnClose').unbind("click");
$('#btnClose').click(function(){
window.location = SITEURL+"cart/rollPdf/?POrderNo="+implode(',', $orderIDArr);
window.open(ord,'winname','directories=no,titlebar=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=400,height=350');
return false
});
}
答案 0 :(得分:0)
每当你想在PHP中使用PHP变量时,你需要回应它。例如,<?php echo implode(',', $orderIDArr);?>
在你的代码中尝试像这样,
function popupEvent(){
$('#btnClose').unbind("click");
$('#btnClose').click(function(){
window.location = SITEURL+"cart/rollPdf/?POrderNo=<?php echo implode(',', $orderIDArr);?>"; // Changed here
window.open(ord,'winname','directories=no,titlebar=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=400,height=350');
return false
});
}
希望这能帮助您解决问题...
修改强>
function popupEvent(){
$('#btnClose').unbind("click");
$('#btnClose').click(function(){
ord = SITEURL+"cart/rollPdf/?POrderNo=<?php echo implode(',', $orderIDArr);?>"; // Changed here
window.open(ord,'winname','directories=no,titlebar=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=400,height=350');
return false
});
}