Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

317
Vistas
Using js load to reload content of multiple tables but with transfered php variables/arrays

So first of all let me explain how my php/js setup looks like:

enter image description here

enter image description here

So now when you have an idea of how it looks, I have a question about how to do my load, to reload my table without reloading my page.

I know how to do it the simple way like this:

PHP (getTable.php) - this can be any server side code (asp, html, etc..)

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

Then, in your JS, you can easily refresh the table by using the load() method:

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>

But how can I use the $('#tableHolder').load('getTable.php'); and transfer the variables needed to getTable.php string/arrays?. Because I need to run a loop in this file running sql queries, instead of in my dashboard.php/functions.php file. Because then I could just update my tables after something has been changed with load.

what I need to do:

//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 Respuestas
Responde la pregunta

0

You can use second parameter in load() to send array. That should send as POST.

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

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

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda