I need to post a text-field value to server but i have not placed the text-field in side the form tag.Here is the details of my use-case
i have an anchor tag like
<a href="${request.contextPath}/login" class="login">LOGIN</a>
This anchor tag is not inside any form tag and i need to send one extra value to the server and don’t want that value to append as query string.
I have created a hidden filed and have provided the required value to that hidden field, but when i click on the Login link and its getting to my Controller class this hidden field value is not available.
Is there any way to send that value to server side class as a request parameter?
You can use ajax to do that, i suggest to use Jquery
$.post(‘loginhandle’, {username:$(‘#username’).val(), password: $(‘#password’).val()} function(){});