How to simply send a request parameter with jquery form submit?
form-submit, javascript, jquery
Solution
try this
function form_submit()
{
//var myparam = "abc";
// add hidden field to your form name="myparam" and value="abc"
$('#receiptsForm').append('<input type="hidden" name="myparam " value="abc" />');
$("#receiptsForm").submit();
}
Problem
I am able to submit a form as `Post` type using the following in my javascript: ``` $("#receiptsForm").submit(); ``` But I also want send across a parameter `myparam` as well with the request which I'll be retrieving in my spring controller using `httpServletRequest.getParameter("myparam")`: ``` var myparam = "abc"; $("#receiptsForm").submit(); ``` What's the best I can do?