jquery - How to add additional fields to form before submit? -
is there way use javascript , jquery add additional fields sent http form using post?
i mean:
<form action="somewhere" method="post" id="form"> <input type="submit" name="submit" value="send" /> </form> <script type="text/javascript"> $("#form").submit( function(eventobj) { // want add field "field" value "value" here // post data return true; } </script>
yes.you can try hidden params.
$("#form").submit( function(eventobj) { $('<input />').attr('type', 'hidden') .attr('name', "something") .attr('value', "something") .appendto('#form'); return true; });
Comments
Post a Comment