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

124
Views
No puedo llamar a una clase jQuery en PHP

Estaba tratando de recargar un div en una función de PHP pero no funciona. Todo funciona pero no la recarga div:

 function refresh() { $servername = "localhost"; $username = "root"; $password = ""; $db = "wp_4lous"; $conn = new mysqli($servername, $username, $password, $db); $checklog = mysqli_fetch_row(mysqli_query($conn, 'SELECT numero_voti FROM voti WHERE candidato="LOG"')); if ($checklog[0] == '10') { mysqli_query($conn, 'UPDATE voti SET numero_voti="0" WHERE candidato="LOG" AND numero_voti="10"'); echo '<script> updateDiv(); </script>'; } }; ?> <script type="text/javascript"> function updateDiv() { $("#here").load(window.location.href + " #here" ); } </script>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Puede probar un enfoque diferente, la forma en que lo está haciendo no funcionará. Use una variable php y asigne algo útil para comprender que su actualización de SQL está lista, y use esa variable dentro del script para hacer el trabajo.

Código de muestra a continuación: he usado una variable $ recUpdated y modifiqué su código, eche un vistazo.

 $recUpdated = "NO"; function refresh() { $servername = "localhost"; $username = "root"; $password = ""; $db = "wp_4lous"; $conn = new mysqli($servername, $username, $password, $db); $checklog = mysqli_fetch_row(mysqli_query($conn, 'SELECT numero_voti FROM voti WHERE candidato="LOG"')); if ($checklog[0] == '10') { mysqli_query($conn, 'UPDATE voti SET numero_voti="0" WHERE candidato="LOG" AND numero_voti="10"'); $recUpdated = "YES"; } }; ?> <script type="text/javascript"> <?php if($recUpdated == "YES") { ?> $("#here").load(window.location.href + " #here" ); <?php } ?> </script>
about 4 years ago · Juan Pablo Isaza 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!