English | 正體中文 | 简体中文

jQuery Load


以回传的资料替换掉html
$("#statistics").load('car-sale.htm');

范例
Car sale report
Report pending...
 原始资料

范例程式码Expand
<!-- HTML -->
<div id="example-section36">    
    <div>Car sale report</div>
    <div id="div361">Report pending...</div>
    <button id="btn362" type="button">Click to load car sale report</button>    
    &nbsp;<a href="/backend/data/car-sale.htm" target="_blank">Original car sale report</a>
</div>



<!-- Javascript -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function (){
    $("#btn362").click(function(){
        $("#div361").load("/backend/data/car-sale.htm");    
    });
});
</script>




载入页面中指定的内容
//载入id名称为'september-report'的内容
$("#statistics").load('car-sale.htm #september-report'); 

范例
Car sale report(September)
Report pending...
 原始资料

范例程式码Expand
<!-- HTML -->
<div id="example-section37">    
    <div>Car sale report(September)</div>
    <div id="div371">Report pending...</div>
    <button id="btn372" type="button">Click to load September car sale report</button>    
    &nbsp;<a href="/backend/data/car-sale.htm" target="_blank">Original car sale report</a>
</div>



<!-- Javascript -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function (){
    $("#btn372").click(function(){
        $("#div371").load("/backend/data/car-sale.htm#september");    
    });
});
</script>



© 2012 PureExample.com contact