Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

108
Visualizações
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.

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

Did you tried below

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

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. :)

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda