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的更多相关文章

  1. AJax 学习笔记二(onreadystatechange的作用)

    AJax 学习笔记二(onreadystatechange的作用) 当发送一个请求后,客户端无法确定什么时候会完成这个请求,所以需要用事件机制来捕获请求的状态XMLHttpRequest对象提供了on ...

  2. Ajax学习笔记demo

    AJAX学习 AJAX简介: 全称:Asynchronous JavaScript and XML (JavaScript执行异步网络请求(JS和XML)),通过AJAX可以在浏览器向服务器发送异步请 ...

  3. 基于PHP的AJAX学习笔记(教程)

    本文转载自:http://www.softeng.cn/?p=107 这是本人在学习ajax过程所做的笔记,通过本笔记的学习,可以完成ajax的快速入门.本笔记前端分别使用原生态的javascript ...

  4. ajax学习笔记1

    ajax是什么? ajax即“Asynchronous Javascript + XML”(异步JavaScript和XML),是指一种创建交互式网页应用的网页开发技术.能够快速的从服务器获得所需数据 ...

  5. AJAX学习笔记

    AJAX不是一种编程语言,AJAX是一种实现网页异步加载的技术,即不刷新网页也能部分的更新网页的内容.如:提交表单信息,通过ajax可以不刷新页面来使得人们明白如何正确的填写信息,判断填写信息的错误或 ...

  6. Jquery ajax 学习笔记

    本人的js & jq 一直是菜鸟级别,最近不忙就看了看ajax方面的知识,文中部分内容参考自这里&这里 之前一直用js写ajax现在基于jq实现方便多了~ $.get & $. ...

  7. Ajax学习笔记2之使用Ajax和XML

    <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Using Ajax wit ...

  8. Ajax学习笔记1之第一个Ajax应用程序

    代码 <head> <title>An Ajax demo</title> <script src="../js/jquery-1.4.1.js&q ...

  9. Ajax学习笔记(二)

    二.prototype库具体解释 1.prototype库的使用 //导入下载好的prototype.js文件 <script type="text/javascript" ...

随机推荐

  1. nodejs npm包管理常用命令介绍

    1.输入 npm config ls -l 可以查看当前的设置 2.针对某一项设置,可以通过下面方式: npm config set 属性名 属性值 eg:npm config set prefix ...

  2. prcharm 注册码

    JetBrains全系列在线激活中心 使用方法: 1. 点击Help,选择Register.打开注册页面. 2. 选择License server, 在License server address 中 ...

  3. 【转】IDEA快捷键功能说明及Eclipse对应操作

    1.Ctrl+z是撤销快捷键 2.如果想恢复Ctrl+z 掉的内容,按快捷键为:Ctrl + Shift + Z.方可 3.Ctrl-H(Browse Type Hierarchy) Ctrl + A ...

  4. math.js 使用...

    math.config({ number: 'BigNumber' }); 没有这句..依旧不能精确计算...

  5. POJ_2431 Expedition 【数据结构】

    一.题面 POJ2431 二.分析 主要说几个坑 1.给出的点需要根据下标排序. 2.根据不同的方式要把起始点或者终点加进去.我没有转换距离,而是直接从起始点到终点根据距离不断相减判断的,那么起点就是 ...

  6. PIE SDK矢量分级渲染

    1. 功能简介 分级渲染是矢量的一种数据表达方式.通过选取一个字段,并根据实际需要对字段的数据进行分级,并对每一级设置不同的符号,已达到区分显示的效果. 2. 功能实现说明 2.1. 实现思路及原理说 ...

  7. css百分比单位

    1 :字体大小 父级字体的百分比 2:margin-left margin-top 父级容器的宽度 3:宽高 width: 50%; 父级宽的一半height: 50%; 父级高的一半

  8. element-ui Form表单验证

    element-ui Form表单验证规则全解 element的form表单非常好用,自带了验证规则,用起来很方便,官网给的案例对于一些普通场景完全没问题,不过一些复杂场景的验证还得自己多看文档摸索, ...

  9. SpringFox

    简介     http://projects.spring.io/spring-framework null

  10. (转)CentOS 7 sytemctl 自定义服务开机启动

    CentOS 7 sytemctl 自定义服务开机启动 原文:http://blog.csdn.net/ithomer/article/details/51766319 CentOS 7继承了RHEL ...