Changes between Initial Version and Version 1 of waue/2011/0825


Ignore:
Timestamp:
Aug 25, 2011, 4:27:59 PM (13 years ago)
Author:
waue
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • waue/2011/0825

    v1 v1  
     1
     2
     3
     4 * record_count.php
     5
     6{{{
     7#!php
     8<?php
     9date_default_timezone_set('ROC');
     10echo date("D M j G:i:s T Y");
     11?>
     12}}}
     13
     14 * demo1.html
     15
     16{{{
     17#!txt
     18<!doctype html>
     19
     20<meta charset="UTF-8">
     21<script type="text/javascript" src="http://ajax.googleapis.com/ajax/
     22libs/jquery/1.3.0/jquery.min.js"></script>
     23<script type="text/javascript">
     24var auto_refresh = setInterval(
     25function ()
     26{
     27$('#MyRefresh').load('record_count.php').fadeIn("slow");
     28}, 2000); // refresh every 10000 milliseconds
     29</script>
     30
     31<title> waue </title>
     32<body>
     33<div id="MyRefresh"> 每兩秒重新導入資料 </div>
     34</body>
     35
     36}}}
     37
     38 * demo2.html
     39
     40{{{
     41#!text
     42<!doctype html>
     43
     44<meta charset="UTF-8">
     45<script type="text/javascript" src="http://ajax.googleapis.com/ajax/
     46libs/jquery/1.3.0/jquery.min.js"></script>
     47<script type="text/javascript">
     48
     49function updateFun() {
     50  $.ajax({
     51    type: 'GET',
     52    url: 'record_count.php',
     53    timeout: 2000,
     54    success: function(php_data) {
     55      $("#some_div").html(php_data);
     56      $("#notice_div").html('waue');
     57      window.setTimeout(updateFun, 1000);
     58    },
     59    error: function (XMLHttpRequest, textStatus, errorThrown) {
     60      $("#notice_div").html('Timeout contacting server..');
     61      window.setTimeout(updateFun, 60000);
     62    }
     63});
     64}
     65$(document).ready(function() {
     66    updateFun();
     67});
     68
     69</script>
     70
     71<title> waue </title>
     72<body>
     73<table>
     74<tr>
     75<td> 使用者 </td><td> 說明 </td><td> 時間 </td>
     76</tr>
     77<tr>
     78
     79<td><div id="notice_div"> </div></td>
     80<td><div id="no_div"> not reload </div></td>
     81<td><div id="some_div"> some_div </div></td>
     82</tr>
     83</table>
     84</body>
     85
     86
     87
     88}}}
     89
     90