Question

<div id='mydiv'>    
   <a href="update.php" target="_blank" onClick="return openWindowReload(this)">update</a>
</div>
    <script>
          function openWindowReload(link) {
              setTimeout(function(){  
              var href = link.href;
                window.open(href,'_blank');
                document.location.reload(true)
                }, 5000);
              return false;
        }
    </script>

so i have this code that force to refresh (after 5 secs) the current page after clicking the button 'update' (target = "_blank")...

but i want to reload only a particular div....

explanation:

update button is only visible when field in table updating = false ... so when it is true update button is not visible..but when u click the button update it will 1st update the table and set updating = true

update.php

<?php
mysqli_query($con, 'UPDATE TABLE sET updating = TRUE');
(long code in here)
?>

so can u pls help me guys to achieve my goal.....

No correct solution

OTHER TIPS

Using jquery $.post shorthand ( http://api.jquery.com/jquery.post/ ), for example:

$(document).ready(function(){


  $.post( "update.php", function( data ) {
      // wrap this with the timeout, if you need
      // but the method post is asynchronous already and takes time
      $( ".update" ).hide();
  });


});

The html:

<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>

     <button class="update">Update!</button>

</body>
</html>

That's all! Hope this helps!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top