Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

181
Views
My form is automatically submitting when i make a ajax call

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!

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

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.

about 4 years ago · Juan Pablo Isaza Report

0

add the attribute type="button" to the button

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!