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
Open connection to MongoDB when page is loaded

new web developer here,

I am creating a test website where I can input data and add it to my MongoDB database. I have a JavaScript file that manages the connection with my MongoDB database (app.js), and I have another JavaScript file that manages the elements within my webpage. (script.js)

I am trying to make it so when I load the page where I input data, I can call the method which connects the database, and I can use that allows me to push form data to my MongoDB database.

The only thing I am struggling with is how I would detect that the webpage is loaded and run the method that opens my database.

I am also struggling to understand how to pass my 'db' variable into my script.js file to allow me to get data from my webpage.

Any help is appreciated, I am using WebStorm to create my website.

EDIT: And links to resources that solve a similar issue to mine (basically sending data to MongoDB from a webpage), would be very helpful! I think I am also using nodejs for my app.js file

about 4 years ago · Juan Pablo Isaza
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