我正在尝试将 php 变量传递到 java 脚本 window.location 中,该脚本在从数据库中删除项目后将用户返回到当前列表视图。我似乎无法使语法正确。
代码:
function confirmation(a) {
var currString = "<? echo $currString ?>";
var answer = confirm("Are you sure you want to delete this item?")
if (answer){
alert("The item has been deleted")
window.location = "list.php?s='. $currString .'&=delete=true&id=" + a;
}
else{
alert("The item has not been deleted")
}