代碼如下:
<script src="../js/jquery-1.4.2.js" type="text/javascript"></script>
<script type="text/javascript">
function chlink() {
var url = "../handler/userfirend.ashx";
$.get(url, function(data) {
var data1 = data.toString();
$("#sp1").html(data + new Date());
})
}
$(function() {
timeID = setInterval('chlink()', 1000); //注意:執行的函數需要加引號,否則會報錯的
});
</script>