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 ...
随机推荐
- simple HTTP server with upload
#!/usr/bin/env python """Simple HTTP Server With Upload. https://github.com/tualatrix ...
- IOS UI-UISearchController
ViewController.m // // ViewController.m // IOS_0224_查找联系人 // // Created by ma c on 16/2/24. // Copyr ...
- Linux 磁盘管理,Linux vi/vim
一.Linux 磁盘管理 Linux磁盘管理好坏直接关系到整个系统的性能问题. Linux磁盘管理常用三个命令为df.du和fdisk. df:列出文件系统的整体磁盘使用量 du:检查磁盘空间使用量 ...
- 杀死dialog
先 pkill -9 normal.sh 和 pkill -9 terminal_ui.sh 然后在pkill -9 dialog
- python:打包成exe程序
1.需要安装 py2exe 2.示例代码: #exetest.py #创建一个gui界面,只用一个标签和按钮,无功能 from Tkinter import * win = Tk() label = ...
- Java 进阶7 并发优化 5 并发控制板方法
Java 进阶7 并发优化 5 并发控制板方法 20131114 前言: Java 中多线程并发程序中存在线程安全的问题,之前学习 Java的同步机制,掌握的同步方法只有一种就是使用 ...
- flash cc新建swc文件
- PostgreSQL备份工具-pg_backrest(转)
转自:http://blog.chinaunix.net/uid-7270462-id-5777877.html 官网:https://pgbackrest.org 一.配置集中备份服务器 1.1 备 ...
- 目标检测 - Tensorflow Object Detection API
一. 找到最好的工具 "工欲善其事,必先利其器",如果你想找一个深度学习框架来解决深度学习问题,TensorFlow 就是你的不二之选,究其原因,也不必过多解释,看过其优雅的代码架 ...
- HAWQ + MADlib 玩转数据挖掘之(二)——矩阵
矩阵是Madlib中数据的基本格式,通常是二维的.在Madlib中,数组的概念与向量类似,数组通常是一维的,是矩阵的一种特殊形式. 一.矩阵表示 MADlib为矩阵提供了两种表示形式:稠密和稀疏. 1 ...