หน้าเว็บ

Thursday, October 22, 2015

jQuery show content with load page โหลดข้อมูล page ด้วย jQuery

<script src="app/assets/js/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
 $('#showcontentbutton').on('click', function() {  
  $("#loading_img").show();
  $( "#result" ).load('content.php',
   function(responseTxt,statusTxt,xhr){
    if(statusTxt=="success"){
       $("#loading_img").hide();
    }
     } );    
 });
 });
</script>
<input type="button" id="showcontentbutton" value="show" />
<img src="themes/images/vtbusy.gif" id="loading_img" style="vertical-align:middle; margin-left:5px; display:none;" />
<div id="result"></div>

No comments:

Post a Comment