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

146
Views
Ajax form with post method

The AJAX form does not want to work, it throws an error. I need it to work when a button is clicked and all data is refreshed.

<form name="form" id="form" class="form">
     
      <div class="field">
        <label for="input-kitId" class="label is-size-7 has-text-weight-light has-text-left">Order ID</label>
        <div class="field">
          <div class="control is-expanded">
          <input type="text" id="input-kitId" class="home-form__input input is-danger" name="number" value="" placeholder="Order ID"/>
          </div>
        </div>
      </div>
      
      <div class="field">
        <label for="input-firstName" class="label is-size-7 has-text-weight-light has-text-left">Email</label>
        <div class="field"><div class="control is-expanded">
          <input type="text" id="input-firstName" class="home-form__input input" name="email" value="" placeholder="Email"/>
          </div>
        </div>
      </div>
      <button type="submit" class="button is-midnightBlue">Generate Booking Reference</button>
    </form>        
   
<script type="text/javascript">
  $("#form").submit(function(e) {
    e.preventDefault();
    var form = $(this);
    var url = form.attr('action');
    
    $.ajax({
      crossDomain: true,
           type: "POST",
           url: 'https://www.harleymedic.co.uk/qrcodes/form.php',
           data: form.serialize(),
           success: function(data)
           {
               alert(data);
           }
         });
  
    
});

</script>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Try to add a form method. Get or Post method Ex: form method="post"

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!