Javascript/JQuery:设置请求属性
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17897961/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Javascript/JQuery: set a request attribute
提问by Sefran2
With var test = "${attributename}";
is possible to get the request attribute "attributename" from javascript/jquery.
随着var test = "${attributename}";
有可能获得从JavaScript / jQuery的请求属性“的AttributeName”。
Is there a way to set a request attribute in a similar way in javascript/jquery?
有没有办法在 javascript/jquery 中以类似的方式设置请求属性?
采纳答案by Suresh Atta
set a request attribute in a similar way in javascript/jquery
NO.
不。
Request and response available on server side ...you cannot access in javascript.
服务器端可用的请求和响应......您无法在 javascript 中访问。
var test = "${attributename}";
resolves on compile time at server side.
在服务器端的编译时解析。
You might misunderstand that jsp and javascript
existed on same document
.Yes but JSP part compiles on server side itself comes to client
.
您可能会误解 jspjavascript
并存在于同一个document
。是的,但 JSP 部分在服务器端编译本身就变成了client
.
I did'nt get your intention here, that while sending request
,set parameter
and do a request
.No matter weather it is Ajax,Html form ..etc
我没有在这里得到你的意图,在发送request
、设置parameter
和做一个。request
不管天气是 Ajax,Html 形式 ..etc
回答by blink-fish
Your question wasn't phrased too clearly, but if you are looking to get/set the request parameters of the url... take a look at the following posts:
您的问题没有表述得太清楚,但是如果您想获取/设置 url 的请求参数……请查看以下帖子:
Get a request parameter from the current url: How can I get query string values in JavaScript?
从当前 url 获取请求参数: 如何在 JavaScript 中获取查询字符串值?
And set a request parameter: Adding a parameter to the URL with JavaScript
并设置一个请求参数: 用 JavaScript 向 URL 添加一个参数