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. [Beta阶段]第一次Scrum Meeting

    Scrum Meeting博客目录 [Beta阶段]第一次Scrum Meeting 基本信息 名称 时间 地点 时长 第一次Scrum Meeting 19/04/29 大运村寝室6楼 70min ...

  2. 【Leetcode】Divide Two Integers

    Divide two integers without using multiplication, division and mod operator. class Solution { public ...

  3. JavaScript 调用 Windows 的打印 代码

    JavaScript 调用 Windows 的打印 代码 2009-02-24 10:36 <%@ Page Language="C#" AutoEventWireup=&q ...

  4. ssm框架的搭建流程

    1.新建一个Maven project (1)选中create a simple project,自动配置必要的文件 (2)Packaging选择war类型.jar和war的区别就是一个是普通的jav ...

  5. 危险系数(枚举点+bfs)--------蓝桥备战系列

    标题:危险系数 抗日战争时期,冀中平原的地道战曾发挥重要作用. 地道的多个站点间有通道连接,形成了庞大的网络.但也有隐患,当敌人发现了某个站点后,其它站点间可能因此会失去联系.        我们来定 ...

  6. 【DP】【单调队列】洛谷 P2216 [HAOI2007]理想的正方形 题解

        算是单调队列的复习吧,不是很难 题目描述 有一个$a\times b$的整数组成的矩阵,现请你从中找出一个$n\times n$的正方形区域,使得该区域所有数中的最大值和最小值的差最小. 输入 ...

  7. os.path模块

    什么是os.path模块 该模块用于处理路径,我们知道python是一门跨平台的语言,二每种操作系统,文件路径是截然不同的,为了使程序可以在不同平台生正确运行,python提供了该模块,使用该模块可以 ...

  8. 组合数取模介绍----Lucas定理介绍

    转载https://www.cnblogs.com/fzl194/p/9095177.html 组合数取模方法总结(Lucas定理介绍) 1.当n,m都很小的时候可以利用杨辉三角直接求. C(n,m) ...

  9. fopen\fread\fwrite\fseed函数的使用

    使用 <stdio.h> 头文件中的 fopen() 函数即可打开文件,它的用法为: FILE *fopen(char *filename, char *mode); filename为文 ...

  10. VUE--mixins的一些理解。

    概念:混入 (mixins) 是一种分发 Vue 组件中可复用功能的非常灵活的方式.混入对象可以包含任意组件选项.当组件使用混入对象时,所有混入对象的选项将被混入该组件本身的选项. 用法: 1.创建混 ...