是否可以将var reason
的内容传递给action = report?
function redirectConfirm(url)
{
var msg = "Are you sure?";
var reason = prompt("Reason");
if (confirm(msg))
{
location.href=url;
}
}
并链接
<a onClick="javascript:redirectConfirm('thread.php?id=$id&action=report');">Report post</a>
答案 0 :(得分:0)
您可以将其作为查询字符串传递:
location.href=url + '&reason=' + reason;
稍后在PHP中,您可以通过$_GET
:
$_GET['reason'];