php+ajax+jquery 定时刷新页面数据
testajax.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gbk" />
<title>testajax</title>
</head>
<body>
<script src='http://www.kuitao8.com/images/js/jquery-1.9.1.min.js'></script>
<script type= "text/javascript">
$(document).ready(function() {
function update() {
$.ajax({
type: 'GET',
url: 'ajax.php',
success: function(data) {
$("#timer").html(data);
//window.setTimeout(update, 1000);
},
});
}
setInterval(function(){update();}, 1000);
//update();
});
</script>
<div style="margin:80px auto;width:500px;font-size:32px;color:red;">
<div id="timer"> </div>
</div>
</body>
</html>
ajax.php
<?php
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . 'GMT');
header('Cache-Control: no-cache, must-revalidate');
include_once 'inc/conn.php';
include_once 'inc/utility2.php';
include_once 'inc/utility_all.php';
include_once 'inc/utility.php';
global $connection;
$stunum="4257330415748211";
$snum='3';
$sql = "select * from jo_reviewmsg where pnum='{$stunum}' and snum='{$snum}' and status='2' order by id desc limit 1";
$result=mysql_query($sql,$connection);
if($row=mysql_fetch_array($result)){
$flag=$row['flag'];
$reason=$row['reason'];
$retstr=$flag.$reason;
}
else
$retstr='';
date_default_timezone_set("Asia/Shanghai");
echo date("Y-m-d H:i:s")." ret=".$retstr;
?>
php+ajax+jquery 定时刷新页面数据的更多相关文章
- Ajax实现定时刷新页面
function deleteValue(){ var refresh = function() { $.ajax({ type:'post', url:'/Application/index ...
- .net MVC中使用angularJs刷新页面数据列表
使用angularjs的双向绑定功能,定时刷新页面上数据列表(不是刷新网页,通过ajax请求只刷新数据列表部分页面),实例如下: @{ Layout = null; } <!DOCTYPE ht ...
- Ajax 实现无刷新页面
注意:如本文所用,在前面的文章库的数目可以在源代码中找到,我将指示在文本,其中链路,为了缩短制品的长度,阅读由此带来的不便.乞求被原谅. 评论文章 Ajax 实现无刷新页面.其原理.代码库.代码. 这 ...
- Angular 定时器$timeout和$interval关于定时刷新页面和发送请求的用法
项目中有用到定时器定时刷新页面的数据,在网上查看了一些资料,整理了一下,备忘. $timeout 用法如下:$timeout(fn,[delay],[invokeApply]); fn:一个将被延迟执 ...
- JS定时刷新页面及跳转页面
JS定时刷新页面及跳转页面 Javascript 返回上一页1. Javascript 返回上一页 history.go(-1), 返回两个页面: history.go(-2); 2. history ...
- JSP简单练习-定时刷新页面
<%@ page contentType="text/html; charset=gb2312" %> <%@ page import="java.ut ...
- Python3.x:定时获取页面数据存入数据库
Python3.x:定时获取页面数据存入数据库 #间隔五分钟采集一次数据入库 import pymysql import urllib.request from bs4 import Beautifu ...
- 【jQuery】: 定时刷新页面
<%@page import="qflag.ucstar.seatmonitor.manager.SeatMonitorManager"%><%@ page la ...
- jQuery 使用ajax,并刷新页面
<script> function del_product_information(id) { $.ajax({ url: "{% url 'del_product_inform ...
随机推荐
- IOS-启动图和开屏广告图,类似网易
作者:若锦 原文链接:http://www.jianshu.com/p/e52806516139 启动图是在iOS开发过程中必不可少的一个部分,很多app在启动图之后会有一张自定义的开屏广告图,点击该 ...
- IOS-源代码管理工具(SVN)
一.使用环境 要想利用SVN管理源代码,必须得有2套环境 服务器 用于存储客户端上传的源代码 可以在Windows上安装Visual SVN Server 大部分情况下,公司的开发人员不必亲自搭建SV ...
- SQL SERVER 算法执行效率
较差的性能 <---没有索引(为每个表执行表扫描) --->非聚集非覆盖索引(seek+局部有序扫描+lookups) ---> 聚集索引(seek+局部扫描) ---> 非聚 ...
- SCM-MANAGER-禁用用户
用管理远用户登录到scm-manager的管理界面http://*.*.*.*:8081/ 设置目标用户为禁用 验证 非 “active” 状态 目标用户客户端不能pull 一直提示登录
- LeetCode OJ:Decode Ways(解码方法)
A message containing letters from A-Z is being encoded to numbers using the following mapping: 'A' - ...
- C++设计模式之-工厂模式的总结
工厂模式分为3种,即简单工厂模式.工厂方法模式.抽象工厂模式,其实大同小异,总结下来就是: 简单工厂模式:一个工厂,多个产品.产品需要有一个虚基类.通过传入参数,生成具体产品对象,并利用基类指针指向此 ...
- 03_模拟DVD
package com.entity; import java.text.SimpleDateFormat; import java.util.Date; public class DVD { pri ...
- EFM32 ARM+ KEIl program
1Hardware connection When using the EFM32 starter kit to make a JLINK burn, you must connect the con ...
- 报错:java.lang.IllegalArgumentException: object is not an instance of declaring class
反射的报错信息如下: java.lang.IllegalArgumentException: object is not an instance of declaring class at sun.r ...
- vue.js 源代码学习笔记 ----- instance render
/* @flow */ import { warn, nextTick, toNumber, _toString, looseEqual, emptyObject, handleError, loos ...