gpt4 book ai didi

java - 如何隐藏我的网址参数?

转载 作者:行者123 更新时间:2023-12-02 00:54:02 25 4
gpt4 key购买 nike

我有几个带有一些链接的 Portlet,我想要的只是隐藏 URL 参数。因此,我认为包含一些 jQuery 代码会很容易,该代码为每个表单构建一个表单并在其上绑定(bind)一个单击事件以提交该表单。

这不起作用。由于某种原因,操作请求未得到满足。

有人对隐藏 URL 参数有不同的建议吗?

最佳答案

<a href="#" onclick="JavaScript: handleThisLink();"> description of link </a>
<form name="mydataform" id="mydataform" action="/actionurlonyoursite" method="post">
<input type="hidden" name="myparam" value="" />
</form>
<script type="text/javascript">
function handleThisLink()
{
// access the hidden element in which you wish to pass the value of the parameter
dojo.byId("myparam").value = "myvalue";
// the value might be precomputed (while generating this page) or
// might need to be computed based on other data in the page
// submit the form by HTTP POST method to the URL which will handle it.
document.forms['mydataform'].submit();
// also possible to actually send a background AJAX request and publish
// the response to some part of the current page, thus avoiding full
// page refresh
// I used dojo.byId() as a shortcut to access the input element
// this is based on dojo toolkit.
}

</script>

关于java - 如何隐藏我的网址参数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1716649/

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