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

130
Visualizações
HTML element dynamic

I made a input number field and want to dynamic render the value of this in the container without reloading the page. I'm using ajax for this but I still have to reload the page.

HTML:

        <form method="post">
            <div class="main">
                <label for="numb">Parcour</label><br><br>
                <input type="number" id="numb" min="1">
            </div>
            <div class="main" style="display: block;">
                <section id="erstellen">
                    
                </section>
            </div>
        </form>

js:

    const xhr = new XMLHttpRequest();
    xhr.open("POST","dynamisch_ajax.html", true);

    xhr.onload = () => {
        if(xhr.status === 200)
        {
            $('#erstellen').html($('#numb').val())
        } else {
            alert('Irgendetwas past nicht')
        }
    }

    xhr.send();
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

you must use from preventDefault method to prevent default refresh :

$("form" ).submit(function( event ) {
  event.preventDefault();
  // The rest of the work
});
about 4 years ago · Juan Pablo Isaza 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