AJAX 学习笔记 2017_05_04
1、使用 AJAX 修改该文本内容
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>AJAX Demo</title>
<script type="text/javascript">
function loadXMLDoc(){
var xmlHttpRequest;
if(window.XMLHttpRequest){
// IE7+,Firefox,Chrome,Opera,Safari 浏览器执行代码
xmlHttpRequest = new XMLHttpRequest();
} else{
// IE6,IE5 浏览器执行代码
xmlHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlHttpRequest.onreadystatechange = function(){
/* alert(xmlHttpRequest.status); */
if(xmlHttpRequest.readyState == 4 && xmlHttpRequest.status == 200){
document.getElementById("myDiv").innerHTML = xmlHttpRequest.responseText;
}
}
xmlHttpRequest.open("get","demo01?t="+Math.random(),true);
xmlHttpRequest.send();
}
</script>
</head>
<body>
<div id="myDiv"><h2>使用 AJAX 修改该文本内容</h2></div><br>
<button type="button" onClick="loadXMLDoc()">修改内容</button>
</body>
</html>
2、用get方式出现浏览器缓存问题:url后面加上一个随机函数,改变每次请求的路径: ?t="+Math.random()
t="+new Date().getTime() 也可以,只要是每次请求都会变化的值。
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>AJAX Demo</title>
<script type="text/javascript">
function loadXMLDoc(){
var xmlHttpRequest;
if(window.XMLHttpRequest){
xmlHttpRequest = new XMLHttpRequest();
} else {
xmlHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
} xmlHttpRequest.onreadystatechange = function(){
if(xmlHttpRequest.readyState == 4 && xmlHttpRequest.status == 200){
document.getElementById("myDiv").innerHTML = xmlHttpRequest.responseText;
}
} xmlHttpRequest.open("get","demo02?t="+Math.random(),true);
xmlHttpRequest.send();
}
</script>
</head>
<body>
<h2>您可能得到的是缓存的结果。为了避免这种情况,请向 URL 添加一个唯一的 ID</h2>
<button type="button" onClick="loadXMLDoc()">请求数据</button>
<p>多次点击按钮,可以看到时间变化。</p>
<div id="myDiv"></div>
</body>
</html>
3、 GET 方法发送信息
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>AJAX Demo</title>
<script type="text/javascript">
function loadXMLDoc(){
var xmlHttpRequest;
if(window.XMLHttpRequest){
xmlHttpRequest = new XMLHttpRequest();
} else {
xmlHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
} xmlHttpRequest.onreadystatechange = function(){
if(xmlHttpRequest.readyState == 4 && xmlHttpRequest.status == 200){
document.getElementById("myDiv").innerHTML = xmlHttpRequest.responseText;
}
} xmlHttpRequest.open("get","demo03?fname=Shawn&lname=Yang&t="+Math.random(),true);
xmlHttpRequest.send();
}
</script>
</head>
<body>
<h2>如果您希望通过 GET 方法发送信息,请向 URL 添加信息</h2>
<button type="button" onClick="loadXMLDoc()">请求数据</button>
<p>多次点击按钮,可以看到时间变化。</p>
<div id="myDiv"></div>
</body>
</html>
4、POST 请求
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>AJAX Demo</title>
<script type="text/javascript">
function loadXMLDoc(){
var xmlHttpRequest;
if(window.XMLHttpRequest){
xmlHttpRequest = new XMLHttpRequest();
} else {
xmlHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
} xmlHttpRequest.onreadystatechange = function(){
if(xmlHttpRequest.readyState == 4 && xmlHttpRequest.status == 200){
document.getElementById("myDiv").innerHTML = xmlHttpRequest.responseText;
}
} xmlHttpRequest.open("post","demo04",true);
xmlHttpRequest.send();
}
</script>
</head>
<body>
<h2>一个简单 POST 请求</h2>
<button type="button" onClick="loadXMLDoc()">请求数据</button>
<p>多次点击按钮,可以看到时间变化。</p>
<div id="myDiv"></div>
</body>
</html>
5、使用 setRequestHeader() 来添加 HTTP 头
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>AJAX Demo</title>
<script type="text/javascript">
function loadXMLDoc(){
var xmlHttpRequest;
if(window.XMLHttpRequest){
xmlHttpRequest = new XMLHttpRequest();
} else {
xmlHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
} xmlHttpRequest.onreadystatechange = function(){
if(xmlHttpRequest.readyState == 4 && xmlHttpRequest.status == 200){
document.getElementById("myDiv").innerHTML = xmlHttpRequest.responseText;
}
} xmlHttpRequest.open("post","demo05",true);
xmlHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
xmlHttpRequest.send("fname=Shawn&lname=Yang");
}
</script>
</head>
<body>
<h2>如果需要像 HTML 表单那样 POST 数据,请使用 setRequestHeader() 来添加 HTTP 头。然后在 send() 方法中规定您希望发送的数据</h2>
<button type="button" onClick="loadXMLDoc()">请求数据</button>
<p>多次点击按钮,可以看到时间变化。</p>
<div id="myDiv"></div>
</body>
</html>
6、使用 async=true
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>AJAX Demo</title>
<script type="text/javascript">
function loadXMLDoc(){
var xmlHttpRequest;
if(window.XMLHttpRequest){
xmlHttpRequest = new XMLHttpRequest();
} else {
xmlHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
} xmlHttpRequest.onreadystatechange = function(){
if(xmlHttpRequest.readyState == 4 && xmlHttpRequest.status == 200){
document.getElementById("myDiv").innerHTML = xmlHttpRequest.responseText;
}
} xmlHttpRequest.open("get","ajax_info2.txt?t=" + Math.random(),true);
xmlHttpRequest.send();
}
</script>
</head>
<body>
<h2>当使用 async=true 时,请规定在响应处于 onreadystatechange 事件中的就绪状态时执行的函数</h2>
<button type="button" onClick="loadXMLDoc()">修改内容</button>
<div id="myDiv"></div>
</body>
</html>
7、async=false
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>AJAX Demo</title>
<script type="text/javascript">
function loadXMLDoc(){
var xmlHttpRequest;
if(window.XMLHttpRequest){
xmlHttpRequest = new XMLHttpRequest();
} else {
xmlHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
} xmlHttpRequest.open("get","ajax_info2.txt?t=" + Math.random(),false);
xmlHttpRequest.send();
//alert(xmlHttpRequest.responseText);
document.getElementById("myDiv").innerHTML = xmlHttpRequest.responseText;
}
</script>
</head>
<body>
<p>我们不推荐使用 async=false,但是对于一些小型的请求,也是可以的。</p>
<p>请记住,JavaScript 会等到服务器响应就绪才继续执行。如果服务器繁忙或缓慢,应用程序会挂起或停止。</p>
<p>注意:当您使用 async=false 时,请不要编写 onreadystatechange 函数 - 把代码放到 send() 语句后面即可</p>
<button type="button" onClick="loadXMLDoc()">修改内容</button>
<div id="myDiv"></div>
</body>
</html>
8、来自服务器的响应并非 XML,请使用 responseText 属性
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>AJAX Demo</title>
<script type="text/javascript">
function loadXMLDoc(){
var xmlHttpRequest;
if(window.XMLHttpRequest){
xmlHttpRequest = new XMLHttpRequest();
} else {
xmlHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
} xmlHttpRequest.onreadystatechange = function(){
if(xmlHttpRequest.readyState == 4 && xmlHttpRequest.status == 200){
document.getElementById("myDiv").innerHTML = xmlHttpRequest.responseText;
}
} xmlHttpRequest.open("get","ajax_info2.txt?t=" + Math.random(),false);
xmlHttpRequest.send();
}
</script>
</head>
<body>
<p>如果来自服务器的响应并非 XML,请使用 responseText 属性。</p>
<p>responseText 属性返回字符串形式的响应。</p>
<button type="button" onClick="loadXMLDoc()">修改内容</button>
<div id="myDiv"></div>
</body>
</html>
9、来自服务器的响应是 XML,而且需要作为 XML 对象进行解析
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>AJAX Demo</title>
<script type="text/javascript">
function loadXMLDoc(){
var xmlHttpRequest;
var txt,x,i;
var xmlDoc;
if(window.XMLHttpRequest){
xmlHttpRequest = new XMLHttpRequest();
} else {
xmlHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
} xmlHttpRequest.onreadystatechange = function(){
/* alert(xmlHttpRequest.readyState); */
if(xmlHttpRequest.readyState == 4 && xmlHttpRequest.status == 200){
xmlDoc = xmlHttpRequest.responseXML;
txt = "";
x = xmlDoc.getElementsByTagName("ARTIST");
for(i=0;i<x.length;i++){
txt = txt + x[i].childNodes[0].nodeValue + "<br>";
}
document.getElementById("myDiv").innerHTML = txt;
}
} xmlHttpRequest.open("get","cd_catalog.xml?t=" + Math.random(),true);
xmlHttpRequest.send();
}
</script>
</head>
<body>
<p>如果来自服务器的响应是 XML,而且需要作为 XML 对象进行解析,请使用 responseXML 属性。</p>
<button type="button" onClick="loadXMLDoc()">修改内容</button>
<div id="myDiv"></div>
</body>
</html>
10、用户在输入框中键入字符时,网页与 web 服务器进行通信
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>AJAX Demo</title>
<script type="text/javascript">
function showHint(o){
var xmlHttpRequest;
if(window.XMLHttpRequest){
xmlHttpRequest = new XMLHttpRequest();
} else {
xmlHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
} xmlHttpRequest.onreadystatechange = function(){
if(xmlHttpRequest.readyState == 4 && xmlHttpRequest.status == 200){
document.getElementById("txtHint").innerHTML = xmlHttpRequest.responseText;
}
}
//传递 hint 参数
//t 参数防止客户端缓存
xmlHttpRequest.open("get","gethint?hint="+o+"&t="+Math.random(),true);
xmlHttpRequest.send();
}
</script>
</head>
<body>
<p>用户在输入框中键入字符时,网页如何与 web 服务器进行通信: 请在下面的输入框中键入字母(A - Z):</p>
<p><b>在输入框中尝试输入字母 a:</b></p>
<p><input type="text" id="txt1" onkeyup="showHint(this.value)"/></p>
<p>提示信息:<span id="txtHint"></span></p>
</body>
</html>
11、通过 AJAX 从数据库(没连数据库,模拟了类似的功能)读取信息
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>AJAX Demo</title>
<script type="text/javascript">
function showCustmer(o){
var xmlHttpRequest;
if(window.XMLHttpRequest){
xmlHttpRequest = new XMLHttpRequest();
} else {
xmlHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
} xmlHttpRequest.onreadystatechange = function(){
if(xmlHttpRequest.readyState == 4 && xmlHttpRequest.status == 200){
document.getElementById("txtHint").innerHTML = xmlHttpRequest.responseText;
}
}
//传递 hint 参数
//t 参数防止客户端缓存
xmlHttpRequest.open("get","getcustomer?q="+o+"&t="+Math.random(),true);
xmlHttpRequest.send();
}
</script>
</head>
<body>
<p>下面的例子将演示网页如何通过 AJAX 从数据库读取信息: 请在下面的下拉列表中选择一个客户:</p>
<p>
<select name="customers" onclick="showCustmer(this.value)">
<option value="APPLE">Apple Computer, Inc.</option>
<option value="BAIDU">BAIDU, Inc</option>
<option value="Canon">Canon USA, Inc.</option>
<option value="Google">Google, Inc.</option>
<option value="Nokia">Nokia Corporation</option>
<option value="SONY">Sony Corporation of America</option>
</select>
</p>
<div id="txtHint">客户信息将显示在这...</div>
</body>
</html>
12、读取XML案例
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>AJAX Demo</title>
<style type="text/css">
table,th,td {
border : 1px solid black;
border-collapse: collapse;
}
th,td {
padding: 5px;
}
</style>
<script type="text/javascript">
function loadDoc(){
var xmlHttpRequest;
var i;
if(window.XMLHttpRequest){
xmlHttpRequest = new XMLHttpRequest();
} else {
xmlHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
} xmlHttpRequest.onreadystatechange = function(){
if(xmlHttpRequest.readyState == 4 && xmlHttpRequest.status == 200){
myFunction(this);
}
}
//t 参数防止客户端缓存
xmlHttpRequest.open("get","cd_catalog2.xml?t="+Math.random(),true);
xmlHttpRequest.send();
} function myFunction(xmlHttpRequest){
var xmlDoc = xmlHttpRequest.responseXML;
var table = "<table><tr><th>Artist</th><th>Title</th></tr>"
var cds = xmlDoc.getElementsByTagName("CD");
for(i=0;i<cds.length;i++){
var artist = cds[i].getElementsByTagName("ARTIST")[0].childNodes[0].nodeValue;
var title= cds[i].getElementsByTagName("TITLE")[0].childNodes[0].nodeValue;
table += "<tr><td>" + artist + "</td><td>" + title + "</td></tr>";
}
table += "</table>";
document.getElementById("myDiv").innerHTML = table;
} function hide(o){
document.getElementById("myDiv").innerHTML = "";
} </script>
</head>
<body>
<p>加载XML文件</p>
<p>
<input type="button" value="收藏我的CD" onclick="loadDoc()"/>
<input type="button" value="收起" onclick="hide(this)"/>
</p>
<div id="myDiv"></div>
</body>
</html>
13、应用callback函数
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>AJAX Demo</title>
<script type="text/javascript">
var xmlHttpRequest;
function loadDoc(url,func){
if(window.XMLHttpRequest){
xmlHttpRequest = new XMLHttpRequest();
} else {
xmlHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
} xmlHttpRequest.onreadystatechange = func;
xmlHttpRequest.open("get",url+"?t="+Math.random(),true);
xmlHttpRequest.send();
}
function myFunction(){
loadDoc("ajax_info2.txt",function(){
if(xmlHttpRequest.readyState == 4 && xmlHttpRequest.status == 200){
document.getElementById("myDiv").innerHTML = xmlHttpRequest.responseText;
}
});
};
</script>
</head>
<body>
<p>callback函数创建一个XMLHttpRequest,并从一个TXT文件中检索数据。</p>
<p>
<input type="button" value="更新数据" onclick="myFunction()"/>
</p>
<div id="myDiv"></div>
</body>
</html>
14、比较完整的ajax方法(参考Blue老师的)
参数解释:
ur:请求的服务器路径
data:请求的数据,json格式。例如:{username:'李四'}
funSucc:处理成功调用的函数
funFailed:处理失败调用的函数
function ajax(url,data,funSucc,funFailed){
//创建 ajax 对象
var oAjax;
if(window.XMLHttpRequest) {
oAjax = new XMLHttpRequest();
} else {
oAjax = new ActiveXObject("Microsoft.XMLHTTP");
}
//连接服务器
oAjax.open('post', url, true);
oAjax.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=utf-8");//post请求设置请求头,charset=服务器端编码(gb2312,gbk,utf-8...),解决了get请求中文乱码的问题
//发送请求
var sData = '';
if(data){
for(var i in data){
sData += (i+ '=' +data[i] + '&');
}
sData = sData.substring(0,sData.length-1);
}
//alert(sData);
oAjax.send(sData);
//处理返回数据
oAjax.onreadystatechange = function(){
if(oAjax.readyState == 4){ //请求处理完成
if(oAjax.status == 200){ //请求成功
funSucc(oAjax.responseText);//文本
} else {
if(funFailed){
funFailed(oAjax.status);
}
}
}
}
}
代码链接: http://pan.baidu.com/s/1mhJDsEG 密码: tmxr
示例程序(用AJAX加载的树状无级菜单)链接: https://pan.baidu.com/s/1kVLrTOV 密码: 81yr
AJAX 学习笔记 2017_05_04的更多相关文章
- AJax 学习笔记二(onreadystatechange的作用)
AJax 学习笔记二(onreadystatechange的作用) 当发送一个请求后,客户端无法确定什么时候会完成这个请求,所以需要用事件机制来捕获请求的状态XMLHttpRequest对象提供了on ...
- Ajax学习笔记demo
AJAX学习 AJAX简介: 全称:Asynchronous JavaScript and XML (JavaScript执行异步网络请求(JS和XML)),通过AJAX可以在浏览器向服务器发送异步请 ...
- 基于PHP的AJAX学习笔记(教程)
本文转载自:http://www.softeng.cn/?p=107 这是本人在学习ajax过程所做的笔记,通过本笔记的学习,可以完成ajax的快速入门.本笔记前端分别使用原生态的javascript ...
- ajax学习笔记1
ajax是什么? ajax即“Asynchronous Javascript + XML”(异步JavaScript和XML),是指一种创建交互式网页应用的网页开发技术.能够快速的从服务器获得所需数据 ...
- AJAX学习笔记
AJAX不是一种编程语言,AJAX是一种实现网页异步加载的技术,即不刷新网页也能部分的更新网页的内容.如:提交表单信息,通过ajax可以不刷新页面来使得人们明白如何正确的填写信息,判断填写信息的错误或 ...
- Jquery ajax 学习笔记
本人的js & jq 一直是菜鸟级别,最近不忙就看了看ajax方面的知识,文中部分内容参考自这里&这里 之前一直用js写ajax现在基于jq实现方便多了~ $.get & $. ...
- Ajax学习笔记2之使用Ajax和XML
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Using Ajax wit ...
- Ajax学习笔记1之第一个Ajax应用程序
代码 <head> <title>An Ajax demo</title> <script src="../js/jquery-1.4.1.js&q ...
- Ajax学习笔记(二)
二.prototype库具体解释 1.prototype库的使用 //导入下载好的prototype.js文件 <script type="text/javascript" ...
随机推荐
- LDdecay计算和做图
先下载PopLDdecay软件(开源GitHub) https://github.com/BGI-shenzhen/PopLDdecay PopLDdecay的安装 1) INSTALL Method ...
- 洛谷 P3380 【模板】二逼平衡树(树套树)
题面 luogu 题解 2019年AC的第一道题~~ 函数名命名为rank竟然会ce 我写的是树状数组套值域线段树(动态开点) 操作1:询问\(k\)在\([l-r]\)这段区间有多少数比它小,再加\ ...
- 用 Koa 提供 Restful service 和查询 MongoDB 的例子
const path = require('path'); const Koa = require('koa'); const app = new Koa(); const compose = req ...
- 获得Windows系统的远程桌面连接历史记录
转载:http://www.mottoin.com/tech/109219.html 渗透技巧—获得Windows系统的远程桌面连接历史记录 0x00 前言 在渗透测试中,远程桌面连接的历史记录不可忽 ...
- (转)网站速度优化技巧:Nginx设置js、css过期时间
网站速度优化技巧:Nginx设置js.css过期时间 原文:http://www.webkaka.com/blog/archives/Nginx-set-the-expiration-time-for ...
- Oracle 数据库实例和数据库
本文参考自oracle数据库实例,数据库的理解,纯属读书笔记,用于加深记忆. 先看Tom关于这二者的解释: 1.数据库 物理操作系统文件或磁盘的集合(我觉得可以理解为数据文件等).使用Oracle 1 ...
- Beam概念学习系列之Pipeline 数据处理流水线
不多说,直接上干货! Pipeline 数据处理流水线 Pipeline将Source PCollection ParDo.Sink组织在一起形成了一个完整的数据处理的过程. Beam概念学习系列之P ...
- ife task0003学习笔记(二):JavaScript原型
function aaa(){} aaa.prototype.bbb=function(){} var obj1=new aaa() var obj2=new aaa() obj1和obj2都有一个属 ...
- <div>里用display:block有用么?
对所有的块元素都没有意义,块元素的dispaly属性默认值为block,没必要再显式定义--除非你之前对块元素的display属性重新定义过. =========================== ...
- QQ音乐:React v16 新特性实践
欢迎大家前往腾讯云+社区,获取更多腾讯海量技术实践干货哦~ 本文由QQ音乐技术团队发表于云+社区专栏 自从去年9月份 React 团队发布了 v16.0 版本开始,到18年3月刚发布的 v16.3 版 ...