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

118
Views
DIV refresh with index

I ask for your help regarding the refreshment of my DIV. When loading my page, _promo.php is called but does not update the data of this page. Can you help me please ? I don't know much about javascript

<?php include($_SERVER["DOCUMENT_ROOT"]."/includes/header.php"); ?>

<?php
try {
    $stat = $pdo->query( "SELECT * FROM tab_shop_produits");
    $i = 0;
    while ($data = $stat->fetch( PDO::FETCH_ASSOC)) {
        $reference = $data["reference"];
?>

<div id="promo_<?php echo $i; ?>" class="mb-2 text-end small text-success blink_"></div>
<input type="hidden" id="txt_reference_<?php echo $i; ?>" value="<?php echo $reference; ?>">
<?php 
        $i++;
    }
} catch(PDOException $e){
    echo "<div class='alert alert-danger'>".$e->getMessage()."</div>";
} 
?>

<script>
$(document).ready(function(){

function loadLog(i) {
   var reference   = document.getElementById("txt_reference_" + i).value;
   var intTotal   = parseInt('<?php echo $i; ?>');
   $.ajax({
      type: "POST",
      url: "_promo.php",
      cache: true,
      data: {reference: reference},
      error: function (e) {console.log('Ajax Error', e);alert('Erreur Ajax');},
      success: function(html){
         document.getElementById("promo_"+i).innerHTML = html;
         console.log(html);
         i=parseInt(i)+1;
         if(i<intTotal){setTimeout(loadLog(i), 1000);}
      }
   });
}
   setTimeout(loadLog('<?php echo $i; ?>'), 1000);
});
</script>

<?php include($_SERVER["DOCUMENT_ROOT"]."/includes/footer.php"); ?>
about 4 years ago · Juan Pablo Isaza
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!