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

100
Views
Convert Form Data into Request Data for an AJAX Request

I am trying to submit my form data via a POST AJAX request and cannot find any solutions.

I can't just get the values by ID or name etc because it is dynamically created depending on data from a database.

I have tried using the childNodes and think this may be a solution but cannot figure it out. Do I need to use JQuery? Can it be done with just JS as I'm a beginner.

Any ideas would be appreciated, cheers.

about 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Did you tried below

$( "form" ).submit(function( event ) {
 ( var jsonData = $( this ).serializeArray() );
  event.preventDefault();
 // --- Your Ajax request
});
about 4 years ago · Santiago Trujillo Report

0

What you can do is just give an id (here i am giving form_id) to the form

$('#form_id').submit(function(){
  e.preventDefault();
  $.ajax({
        type: "POST",
        url: "your_url",
        data: $('#form_id').serialize(),
        success: function (data) {
            alert('ok');
        }
  });
})

Cheers. :)

about 4 years ago · Santiago Trujillo 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!