gpt4 book ai didi

javascript - 如何在 window.location.replace 代码中发送帖子信息

转载 作者:行者123 更新时间:2023-11-28 18:30:41 26 4
gpt4 key购买 nike

我的网站是这样运行的:1. 用户输入用户名和密码,然后按提交。2. 提交时,Ajax 会发送到检查信息并回显 1、2 或 3 的页面。3. 根据ajax结果,将用户发送到应用程序窗口。

我需要什么:当用户被发送到应用程序窗口时,我希望将用户 ID 粘贴到新地址。

    <script>
$(document).on("click", "#submit", function(event)
{
var user = document.getElementById("name").value;
var pwd = document.getElementById("pwd").value;
$.post("userExistCheck.php",
{
userName: user,
userPass: pwd
},
function(result)
{
if (result == "0")
{
window.location.replace("Moment/momentApp.php");
}
else if (result == "1")
{
alert("Password is incorrect!");
}
else
{
alert("User does not exist!");
}
});
})
</script>

最佳答案

嗨,只需更改此行

window.location.replace("Moment/momentApp.php?userid=" + userid);

关于javascript - 如何在 window.location.replace 代码中发送帖子信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38079060/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com