URL parameters not getting passed during javascript submit
I am doing form submit from javascript when a image is clicked. Below is the form tag in my code
<form name="tictactoe" id="tictactoe" method="GET" action="GameAction">
The image is present in the form tag. When i click the image i call a java script method shown below
Code:
function selection(selected){
theform = window.document.tictactoe;
theform.action="GameAction?selection=selected.id";
theform.submit();
}
The problem I am facing is the page gets submitted but i am not able to receive the parameter "selection" in the server.
request.getParameter("selection") is coming as null.
It would be great if someone would help in resolving this problem. I tried googling but didn't get a solution.
Re: URL parameters not getting passed during javascript submit
I found the solution. I had to use the POST method to make it work.
Re: URL parameters not getting passed during javascript submit
This is somewhat confusing , can you just elaborate what was the problem and how did you solve it?
As you said it was showing null value in servlet.. The servlet might be having doGet()...(as your form method is "get").
How can it work , if you change the same to "Post"?:(think):