I'm having trouble to submit the form by clicking button in another form.When i hit the button,it is not redirected to the action servlet, but it redirects into the same page,with a url like this,
with a '?' at the end.This method was working in my sample project.
HTML code
<form autocomplete="off">
    <label>Email</label>
    <input autocomplete="off" autofocus type="text" required="" id="emailIDForm1">
    </label>
    </div>
    <label>Password</label>
    <input autocomplete="off" type="password" min="6" required="" id="logPassId" />
    </div>
    <div>
        <button id="submitForm" class="btn btn-primary">LOGIN</button>
    </div>
    </div>
</form>
<form action="LoginServlet" method="post" id="SecFormLogin" style="display:none">
    <input type="text" name="emailId" id="emailIdForm2" />
    <input type="password" name="password" id="passForm2" />
</form>
and Jquery code
<script>
    $(document).ready(function() {
        $('#logPassId').change(function() {
            var password= $(this).val();
            $('#passForm2').val(password );
        });
        $('#emailIDForm1').change(function() {
            var email= $(this).val();
            $('#emailIdForm2').val(email);
        });
        $("#submitForm").click(function() {
            $("#SecFormLogin").submit();
        });
    });
</script>
and Servlet code is,
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    System.out.println("Called post");}
 
    