Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

221
Views
¿Cómo llamar a la función js en php?

Tengo código php, pero dentro de ese código debería llamar a la función js alert(). ¿Es posible? en caso afirmativo, ¿cómo puedo hacerlo?

 if($findUserRow['active'] == 0){ $message = "You should activate your account!"; alert($message); //here should be pop up window }
over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

if($findUserRow['active'] == 0) { ?> <script> var message = "You should activate your account!"; alert(message); //here should be pop up window </script> <?php }
over 4 years ago · Santiago Trujillo Report

0

Puede hacer eco de Javsascript en la página como se muestra a continuación.

 if($findUserRow['active'] == 0){ $message = "You should activate your account!"; echo "<script> alert(".$message.");</script>"; }
over 4 years ago · Santiago Trujillo Report

0

Siempre debe separar la lógica de back-end de la lógica de front-end.

envíe variables de atrás hacia adelante, luego procese en el frente. Idealmente, desea utilizar plantillas en php. Las cosas pueden complicarse.

 <script> var active = <?php echo $findUserRow['active']; ?>; var message = "You should activate your account!"; if(active == false){ alert(message); } </script>

Concéntrese en aislar el 2. En general, le dará más control.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!