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

316
Views
Usar js load para recargar el contenido de varias tablas pero con variables/matrices de php transferidas

Entonces, antes que nada, permítanme explicar cómo se ve mi configuración de php/js:

ingrese la descripción de la imagen aquí

ingrese la descripción de la imagen aquí

Entonces, ahora que tiene una idea de cómo se ve, tengo una pregunta sobre cómo hacer mi carga, para recargar mi tabla sin recargar mi página.

Sé cómo hacerlo de la manera más simple como esta:

PHP (getTable.php): puede ser cualquier código del lado del servidor (asp, html, etc.)

 <?php echo '<table><tr><td>TEST</td></tr></table>'; ?>

Luego, en su JS, puede actualizar fácilmente la tabla usando el método load() :

HTML

 <div id="tableHolder"></div>

JS

 <script type="text/javascript"> $(document).ready(function(){ refreshTable(); }); /*Call this when table should be updated*/ function refreshTable(){ $('#tableHolder').load('getTable.php'); } </script>

Pero, ¿cómo puedo usar $('#tableHolder').load('getTable.php'); y transfiera las variables necesarias a getTable.php string/arrays ?. Porque necesito ejecutar un ciclo en este archivo ejecutando consultas sql, en lugar de en mi archivo dashboard.php/functions.php . Porque entonces podría actualizar mis tablas después de que algo haya cambiado con la carga.

lo que necesito hacer:

 //Create all the divs needed (the ones to be updated) foreach($arrayThings as $projects){ echo'<div id="'.$projects.'"></div>'; } //JS script that should be triggered when divs has to be updated /*Call this when table should be updated * But how can I transfer data to this php file and load it? cant create the table without doing * some calculations and sql calls to create these tables. */ function refreshTable(id){ $('#'+id).load('getTable.php'); }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Puede usar el segundo parámetro en load() para enviar una matriz. Eso debería enviarse como POST.

 $('#'+id).load('getTable.php', { "param1" : "value1" });

https://api.jquery.com/load/

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!