局部刷新 ajax 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 就是动态、局部地请求服务器,你找个 demo 看看就明白了:<!DOCTYPE html><html><head><script>function loadXMLDoc(){var xmlhttp;if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); }else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("myDiv").innerHTML=xmlhttp.responseText; } }xmlhttp.open("GET","ajax_info.txt",true);xmlhttp.send();}</script></head><body><div id="myDiv"><h2>Let AJAX change this text</h2></div><button type="button" onclick="loadXMLDoc()">Change Content</button></body></html> 页面事先做好隐藏的div,点修改的时候把这个div显示,然后附带要修改的参数的值在里面的文本框中,然后可以用json,把需要修改的值传入后台,做完修改后把那个div隐藏掉,然后用js或jquery触发查询按钮的click事件就可以了。 ajax提交,在成功回调中 把内容写到指定的div里 就可以了 //公共的Ajax请求,方法需要请求地址,请求表单,以及回调函数对象function ajaxSubmitForm(url, form, callBack) { $.ajax({ cache : true, type : "POST", url : url, data : form.serialize(), async : true, error : function(request) { alert("Connection error"); }, success : function(data) { callBack(data); } });} 我觉得问题的关键是 修改和新增的时候另弹一个框,楼主应该用的是模态对话框吧,也就是限制了网页的宽高等出现的对话框,这里的关键是做过修改之后返回值。两种方式 你可以将模态对话框的值拼接后返给父页面,子页面关闭,由父页面ajax请求返回值写入div,或者说子页面直接ajax请求返回值 传给父页面,子页面关闭,父页面根据值写div。楼上都是在讲怎样使用ajax 去看看jquery 对 ajax封装 挺方便的. Hibernate更新BLOB的问题 使用ehcache时集合里再包含集合时怎么操作 解救我这个Javaservlet! 从页面取参数出现空指针异常 word文档存储数据库?? 两个视图的连接 过滤器 oracle+jb9乱码问题? select 问题 我怎样才能实现我的循环? 求一个js正则表达式 spring 管理hibernate事物 得到的hibernatetemplate session都为空
<!DOCTYPE html>
<html>
<head>
<script>
function loadXMLDoc()
{
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","ajax_info.txt",true);
xmlhttp.send();
}
</script>
</head>
<body><div id="myDiv"><h2>Let AJAX change this text</h2></div>
<button type="button" onclick="loadXMLDoc()">Change Content</button></body>
</html>
function ajaxSubmitForm(url, form, callBack) {
$.ajax({
cache : true,
type : "POST",
url : url,
data : form.serialize(),
async : true,
error : function(request) {
alert("Connection error");
},
success : function(data) {
callBack(data);
}
});
}