http 的四大方式
有get,post,delete,put.
其中delete,put在tomcat里模式不支持,需要在web.xml里
<param-name>readonly</param-name>
<param-value>false</param-value>
</init-param>
•接下来,从客户端通过AjaxXMLHTTPRequest发起DELETE/PUT请求:
01.functiongetXMLHTTPRequest(){
02.if(XMLHttpRequest){
03.returnnewXMLHttpRequest();
04.}else{
05.try{
06.returnnewActiveXObject('Msxml2.XMLHTTP');
07.}catch(e){
08.returnnewActiveXObject('Microsoft.XMLHTTP');
09.}
10.}
11.}
12.varreq=getXMLHTTPRequest();
13.req.open('DELETE','http://localhost/test.jsp',false);
14.req.send(null);
15.document.write(req.responseText);
functiongetXMLHTTPRequest(){
if(XMLHttpRequest){
returnnewXMLHttpRequest();
}else{
try{
returnnewActiveXObject('Msxml2.XMLHTTP');
}catch(e){
returnnewActiveXObject('Microsoft.XMLHTTP');
}
}
}
varreq=getXMLHTTPRequest();
req.open('DELETE','http://localhost/test.jsp',false);
req.send(null);
document.write(req.responseText);
•WebDAV也需要使用到这2种Http请求方法。