0

Can I add additional parameters to the below submit function without adding hidden_fields in the form and ajax in rails6

$("#product_form").submit()

Please help. Thanks

jissy
  • 463
  • 5
  • 20
  • 1
    This should help: https://stackoverflow.com/questions/993834/adding-post-parameters-before-submit/56149177 – razvans Aug 30 '21 at 12:05

1 Answers1

0

The below code will append a hidden field with value just before submitting the form

 $("#product_form").append("`<input type='hidden' name='product_order' value='"+product_order+"' >`")

The hidden field will remain in the form if the form is not reloading during form submission

jissy
  • 463
  • 5
  • 20