Dear All,
I'm working on a web application, JSP. I have a script with a javascript function that returns a String. I want this returned String to be passed to another page in a form, when a button is clicked.
Any ideas on how to make this work?
I was thinking of something like:
<form action="nextPage.jsp" method="post ">
<input type="button" value="button" onClick="calledFunction();"> <input type="hidden" name="varname" value="calledFunction();" />
</form>
and then I would call in the nextpage.jsp:
<% out.println(request.getParameter("varname"));%>
But it doesn't work, the output I get is the function name and not the returned value.
Could you help me?