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

134
Visualizações
How to get php database values before the values are loaded using javascript?

So i have 3 pages. upload.php, main.php and script.js. Upload.php lists some database entries, and has a button behind each entry for more info on the entry. When you press the button it gives the ID value from the database with POST in the url and so it loads the info in main.php with the given id.

I have a javascript file: script.js which needs those db values that are echoed on main.php. I watched a tutorial on passing a variable from php to js using ajax. But the problem is that the values on main are only posted when you press the button in upload.php. Which means when i run the script it just fetches from main.php which has no values if the button is not pressed on upload.php.

How do i make the javascript get the values from main?

Im very new to js.

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