经典Ajax调用
function delDepart(){
if(confirm("要删除部门必须删除该部门与员工的关系以及其所有下属部门")){
var departId=form1.departId.value;//部门ID
var url = "Depart/DelDepart.aspx?DepartId="+departId;
xmlHttpRequest=createXMLHttpRequest();
xmlHttpRequest.open("POST",url,true);
xmlHttpRequest.onreadystatechange=function()
{
if(xmlHttpRequest.readyState==4 && xmlHttpRequest.status==200){
alert(xmlHttpRequest.responseText);
cal();
}
}
xmlHttpRequest.send(null);
}
}
相关文档:
What is AJAX
This section is for those who have no idea what AJAX is. If you don’t fall into this category, feel free to skip to the next section.
AJAX stands for asynchronous JavaScript and XML. If you see another term XHR, which is shorthand for XML HTTP request, it’s the same thing. ......
Java代码
@Override
protected ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object cmd,
BindException ex) {
&nb ......
在Web开发程序中,往往由于种种原因,客户会多次操作页面导致数据冗余或不一致, 在ASP.NET AJAX出现之前可以通过对__dopostback()的调用等方法也可以防止页面多次提交。
在ASP.NET AJAX中的页面客户端中有一个叫onInitializeRequest的事件,它在页面初始化之前触发,可以对页面的提交事件进行控制,并且可以调用该事件参 ......
首先把代码给大家,下面是解释
/**
* 获得XMLHttpRequest对象
*/
function createXHR(){
var x=[function(){return new ActiveXObject("Msxm12.XMLHTTP");},function(){return xmhttp=new ActiveXObject("Microsoft.XMLHTTP");},
&nb ......
Buffalo是国人开发的Ajax框架
它可以使用户在js中调用java代码里的方法.
配置方法:
1. web.xml中配置相关servlet 如下:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ......