gpt4 book ai didi

javascript - 添加参数到 windows.location 现在页面不想重定向到所需的表单

转载 作者:行者123 更新时间:2023-12-03 01:44:44 24 4
gpt4 key购买 nike

单击按钮时,我希望页面显示一个警报窗口,然后将用户重定向到不同的表单。最初没有添加任何参数,代码按照我想要的方式工作。添加参数后,页面不会重定向到表单。

Response.Write("<script>alert('Customer visit record for the visit has been created.You will now be taken to customer visit process.');"
+ "window.location='CustomerVisit.aspx?bookingID="+cust_visit.BookingID.ToString()+
"&customerID="+cust_visit.CustomerID.ToString()+"</script>");

我想添加参数,以便我可以在下一个表单中使用它们:

Request.QueryString["bookingID"]

最佳答案

location的值需要用单引号括起来,建议后面跟分号:

Response.Write("<script>alert('...');"
+ "window.location = 'CustomerVisit.aspx?bookingID=" + cust_visit.BookingID.ToString()
+ "&customerID=" + cust_visit.CustomerID.ToString() + "';</script>");

关于javascript - 添加参数到 windows.location 现在页面不想重定向到所需的表单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50690139/

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