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

181
Visualizações
I created a contact us form for my website but I dont know how to strore the data.(JS)

I was making a new service-based website and I created the contact form. When I put my info and submit it, the website refreshes but I don't know where that information goes. I want to be able to store it somewhere, like .txt or something. Thanks in advance. (I use JS).

<form action="">
          <h3>get in touch</h3>
          <input type="text" placeholder="your name" class="box" />
          <input type="email" placeholder="your email" class="box" />
          <input type="tel" placeholder="subject" class="box" />
          <textarea
            placeholder="your message"
            class="box"
            cols="30"
            rows="10"
          ></textarea>
          <input onclick="alert('Thanks For Your Response')" type="submit" value="send message" class="btn" />
          <span>OR</span>
          <a
            class="btn"
            href="tel:9724005492"
            >Call Now</a
          >
        </form>
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

It goes to the URL specified in the action attribute.

The expectation is that you will have some server-side code ready (at that URL) to receive the data and process it.

MDN has a guide to sending and retrieving form data which covers how it works and has examples for a few programming languages.

You said you were using JS. If you are using server-side JS, then it is common to use Express.js, in which case you can set up a body parsing middleware and then read the data from req.body. You can then store it somewhere, which could be a text file, but it is more usual to use a database (which would handle race conditions if you ended up with simultaneous inserts).

MDN has a Working With Forms section in their Express.js tutorial

Client-side JS can't store the data anywhere that is particularly useful for the developer of the website, but you can add an event listener for the form element's submit event and then process the data on the client. There are a few places you could store it on the client (e.g. local storage) but that will stay with the browser and not get to the person running the website.

Client-side JS could also make its own HTTP request (i.e. Ajax) to a server-side program which processes the data. The net result is the same as submitting the form to one though, just with more control over the UI.

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