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" ...
随机推荐
- 【算法笔记】B1042 字符统计
1042 字符统计 (20 分) 请编写程序,找出一段给定文字中出现最频繁的那个英文字母. 输入格式: 输入在一行中给出一个长度不超过 1000 的字符串.字符串由 ASCII 码表中任意可见字符及空 ...
- POJ 2763 (LCA +RMQ+树状数组 || 树链部分) 查询两点距离+修改边权
题意: 知道了一颗有 n 个节点的树和树上每条边的权值,对应两种操作: 0 x 输出 当前节点到 x节点的最短距离,并移动到 x 节点位置 1 x val 把第 x 条边的权值改为 ...
- mysql远程连接详细配置
2018-11-06 CentOS 配置MySQL允许远程登录 Mysql为了安全性,在默认情况下用户只允许在本地登录,可是在有此情况下,还是需要使用用户进行远程连接,因此为了使其可以远程需要进行如下 ...
- Lucene常用类
1.1 IndexWriter: 充当 创造/在索引过程中更新指标的 核心组成部分 1.2 Lucene目录 Directory: 索引的存储位置: 通常是文件的列表: 这些文件被称为索引文件. ...
- Maven---pom.xml 详解(转)
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/20 ...
- linux拓展之 用linux命令 管理windows一秒完成不可思议的操作--本节实战find 移动!!
花里胡哨的东西太多,有时候觉得简单也好! 你学习了Linux,是不是觉得Linux很强大!命令的多样性结合性有没有把你征服? 在那个烈日炎炎的夏日,我下载了辣末多老男孩的视屏----但是突然我只想看t ...
- 成功配置TOMCAT的LOG4J日志系统,格式:HTML+每天以YYYY-MM-DD.LOG命名的日志文件
关于log4j.properties文件在web项目中放的位置,找过很多,最后实践结果是: 一.web项目 二.放在src的目录里面,然后项目生成后会自动在\WEB-INF\classes文件里有份l ...
- 线程同步(windows平台):信号量
一:介绍 信号量也是系统核心对象,它允许多个线程同一时刻访问同一资源,但需限制同一时刻访问资源的最大线程数目. 信号量遵循规则:1.当前资源计数大于0,信号量有效.2.当前资源计数等于0,信号量无效. ...
- Fragment、Activity比较——Android碎片介绍
Fragment是Android honeycomb 3.0新增的概念,Fragment名为碎片不过却和Activity十分相似,下面介绍下Android Fragment的作用和用法.Fragmen ...
- android应用签名详解
1.Eclipse工程中右键工程,弹出选项中选择 android工具-生成签名应用包: 2.选择需要打包的android项目工程: 3.如果已有私钥文件,选择私钥文件 输入密码,如果没有私钥文件见 第 ...