如何在窗口中使用发送邮件信息.位置替换代码


How to send post information with in a window.location.replace code

我的网站是这样工作的: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);

试试这样的东西

我希望这是你想要的,否则就用曼塔回答:(

Html

<input type="hidden" id="userid" name="userid" value="1" />

Jquery

var userid = document.getElementById("userid").value;
$.post("userExistCheck.php",
    {
        userName: user,
        userPass: pwd,
        userid : userid //here u can pass the userid 
    },
<input type="hidden" name="userid" id="userid" />
<script>
 $(document).on("click", "#submit", function(event)
   {
      var userid = document.getElementById("userid").value;
    }
</script>

所以,基本上有了这个,你也可以发送用户id。我还没有写完整的代码,而是应该附加的必要部分