1. load
(1) script:
<script src="jquery-1.2.6.min.js" type="text/javascript">
(2) jsp:
<form id="form0">
.......
</form>
<input id="load" type="button" value="提交" />
<div id="showInfo">
</div>
<script type="text/javascript">
//为id为load的按钮绑定事件处理函数
$("#load").click(function()
{
//向load.action发送Ajax请求,并自动加载服务器响应
$("#showInfo").load("load.action" , $("#form0").serializeArray());
});
</script>
--------------------------------------------------------------------------------------
2. get/post
<script src="jquery-1.2.6.min.js" type="text/javascript">
</script>
<form id="form0">
.......
</form>
<input id="load" type="button" value="提交" />
<div id="showInfo"></div>
<script type="text/javascript">
//为id为load的按钮绑定事件处理函数
$("#load").click(function()
{
//指定向load.action发送请求,以id为form0表单里各表单空间作为请求参数
//或者post
$.get("load.action" , $("#form0").serializeArray() ,
//指定回调函数
function(data , statusText)
{
$("#showInfo").empty();
$("#showInfo").append("服务器响应状态为:" + statusText + "<br />");
$("#showInfo").append(data);
},
//指定服务器响应为html
"html"
);
});
</script>
(1) script:
<script src="jquery-1.2.6.min.js" type="text/javascript">
(2) jsp:
<form id="form0">
.......
</form>
<input id="load" type="button" value="提交" />
<div id="showInfo">
</div>
<script type="text/javascript">
//为id为load的按钮绑定事件处理函数
$("#load").click(function()
{
//向load.action发送Ajax请求,并自动加载服务器响应
$("#showInfo").load("load.action" , $("#form0").serializeArray());
});
</script>
--------------------------------------------------------------------------------------
2. get/post
<script src="jquery-1.2.6.min.js" type="text/javascript">
</script>
<form id="form0">
.......
</form>
<input id="load" type="button" value="提交" />
<div id="showInfo"></div>
<script type="text/javascript">
//为id为load的按钮绑定事件处理函数
$("#load").click(function()
{
//指定向load.action发送请求,以id为form0表单里各表单空间作为请求参数
//或者post
$.get("load.action" , $("#form0").serializeArray() ,
//指定回调函数
function(data , statusText)
{
$("#showInfo").empty();
$("#showInfo").append("服务器响应状态为:" + statusText + "<br />");
$("#showInfo").append(data);
},
//指定服务器响应为html
"html"
);
});
</script>