【发布时间】:2013-10-31 18:54:53
【问题描述】:
在将隐藏值传递给该页面时,我必须重定向到另一个页面。
由于页面链接正在修改,例如 #!/newpage.php 等,表单帖子无法正常工作。
<form id="form1" name="form1" method="post" action="newpage.php">
<input type="hidden" name="pid" id="pid" value="<?php echo $id; ?>" />
<input type="submit" name="button" id="button" value="Send ID" />
</form>
相反,我想使用类似于以下的代码。
$(document).ready(function()
{
$("#sendid").click(function()
{
if($("#pid").val().length == 0)
{
alert("Error!");
}
else
{
$.post("newpage.php",
{
pid:$("#pid").val(),
window.location.href("#!/newpage.php");
}
}
}
});
所以基本上我们需要将隐藏值发送到newpage.php 并在按钮点击时重定向。
【问题讨论】:
标签: javascript php jquery ajax redirect