If $ .post does not work, try the $ .ajax function instead:
$('#target').click(function() { var formdata = $('#loginFrm').serialize(); // will produce { username: "username", pasword: "password"} $.ajax({type: "POST", url: "urlto/tojavapage", data: formdata , success: function(data) { // div container to display error msg $('#loginmessage').html(data); } }); return false; });`
make sure your submit button has a click event that triggers this, e.g.
<input type="button" value="login" id="target" /> <div id="loginmessage"> </div>
thanks
source share