How to use value of a cookie in html code?
I need to retrieve the value of a specific cookie then show it and also
use it in my HTML code.
My code is as following, value is shown after "Value is:" message but I am
not sure how to have it as parameter of myfunc function.
<% Cookie cookies[] = request.getCookies();
for (int i = 0; i < cookies.length; i++) {
if (cookies[i].getName().equalsIgnoreCase("MyCookie")) {
out.println("Value is:" + cookies[i].getValue());
}
}
%>
<form id="everything" onsubmit="myfunc(VALUE NEED TO BE HERE)">
......
No comments:
Post a Comment