jquery AJAX应用
load(url[,data][,callback])------------->通常用来从WEB服务器上获取静态的数据文件
url: string类型 请求HTML页面的URL地址
data(可选): object 发送至服务器的key/value数据
callback(可选):function 请求完成时回调函数
例子:
主页面代码:
<style type="text/css">
* { margin:0; padding:0;}
body { font-size:12px;}
.comment { margin-top:10px; padding:10px; border:1px solid #ccc;background:#DDD;}
.comment h6 { font-weight:700; font-size:14px;}
.para { margin-top:5px; text-indent:2em;background:#DDD;}
</style>
$(function(){
$("#send").click(function(){
$("#resText").load("test.html .para",function (responseText, textStatus, //test.html .para为test.html中.class为para的内容XMLHttpRequest){
alert( $(this).html() ); //在这里this指向的是当前的DOM对象,即 $("#iptText")[0]
alert(responseText); //请求返回的内容
alert(textStatus); //请求状态:success,error
alert(XMLHttpRequest); //XMLHttpRequest对象
});
})
})
<input type="button" id="send" value="Ajax获取" />
<div class="comment">
已有评论:
</div>
<div id="resText" >
相关文档:
http://www.longboo.com/
分页
http://www.longboo.com/Samples/linb/widgets/TreeGrid.Paging/index.html
数据库查询工具
http://www.longboo.com/Samples/comb/OrderManagement/index.html
email工具
http://www.longboo.com/Samples/comb/OutLook/index.html
网店
http://www.longboo.com/Samples/linb/Template ......
AJAX表单提交方法(JSON)
1./*****JAVA**************************************************************/
JAVA类中:
/*****JAVA**************************************************************/
2./*****struts.xml**************************************************************/
struts.xml文件中:
......
xmlHttp形式的Ajax:XmlHttp形式的Ajax IBM技术文档库
以下是利用隐藏iframe实现的ajax:
index.htm
<html>
<head>
</head>
<body>
<iframe id="testFrame" frameborder="0" style="width:0px; height:0px;">
</ifra ......
项目中想用ajax,于是在网上扒了n多资料,犯了n多错误,从今天上班到现在一直在处理这个问题,终于还是把它解决了。
当我看到页面的ajax显示后,我兴奋异常,为了记录自己学习的ajax历程,也为了让更多的人少走弯路,特写此一文以记之!
废话不说了,为了更好的理解,我重做了一个小的项目,以加深印象。现在就以这个小项 ......
XMLHttpRequest 对象使 AJAX 成为可能。
XMLHttpRequest
XMLHttpRequest 对象是 AJAX 的关键。
该对象在 Internet Explorer 5.5 与 2000 年 7 月发布之后就已经可用了,但是在 2005 人们开始讨论 AJAX 和 Web 2.0 之前,这个对象并没有得到充分的认识。
创建 XMLHttpRequest 对象
不同的浏览器使用不同的方法来创建 ......