2005/06/15

开始Ajex

刚刚简单做了一个实验。
使用XMLHttpRequest和服务器进行通讯,比较成功。
-------------------------------------------------------------
var xmlHttp
if (!document.all){
xmlHttp= new XMLHttpRequest();
}else{
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
}

url='http://localhost:8080/UMail4Web/servlet/ibeyond.mail.web.ctrl.Controller';
xmlHttp.open("GET",url,false);
xmlHttp.send(null);
alert(xmlHttp.responseText);
alert(xmlHttp.getResponseHeader("CONTENT-TYPE"));
-------------------------------------------------------------
在firefox1.04和IE6下都通过了。
需要注意的是在firefox下如果这个url和当前页面的url不是同一个服务器地址的话,就会提示没有权限,而ie不会。还有就是所有的方法名都要小写,同样如果大写的话ie认识而ff不行。

没有评论:

发表评论

Mastodon Daily(2024-04-27)

I just watched The Happening (2008) https://trakt.tv/movies/the-happening-2008 #TheHappe...