How can I load php in a div with button onclick events in Javascript? -
i trying load table dynamically in div in php page. want load tables using buttons or links on same page.
i tried this:
<button id="fcluns" type="button" onclick="loadpage(this.id)">fc luns</button> <div id="table"></div> <script type="text/javascript"> function loadpage(clicked_id){ if (clicked_id =="fcluns"){ $("table").html('loadingimage.gif').load('getfcluns.php?name=<?php $host=$_get['name']; echo $host;?>'); } } </script>
i generating table php page getfcluns.php mysql queries executed details database. , getting $host in php , passing helper php generate table.
any other efficient way welcome. want keep page php based only.
try
$("#table").css({'background-image':'loadingimage.gif'}).load( 'getfcluns.php?name=<?php echo $_get[name];?>', function() { $(this).css({'background-image':'none'}); } );
read documentation http://api.jquery.com/load/
Comments
Post a Comment