I am having a form which will submit list of products to the spring backend
I have two separate buttons 1). Submit button to submit the form 2). Fetch available Stock button to check stock availability
When i click Fetch available stock button -- it will invoke a function which will make Ajax call to fetch stock details
But the problem is whenever i click Fetch available stock button
Both ajax call for fetching stock data and form submission also happens.
I don't want the form to submit till i press the submit button
Note: i am having the form in bootstrap modal
Thanks in advance for helping me!
CodePudding user response:
without the code we can't do match but I suggest in the form submitting code you should use e.preventDefault()
to prevent the default behavior of submit button and after you complete all your logic you should submit the form.
CodePudding user response:
add the attribute type="button"
to the button