您的位置:首页 > 编程语言 > PHP开发

phpmailer发送邮件

2010-12-01 12:11 736 查看
function Ajax(){
var _xmlHttp = null;
//创建对象
this.createXMLHttpRequest = function(){
if (window.ActiveXObject) {
_xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}else if (window.XMLHttpRequest) {
_xmlHttp = new XMLHttpRequest();
}
}

//实现回调函数
this.backFunction = function(_backFunction){
_backFunction(_xmlHttp.responseXML);
}
//方法实现
this.ajaxRequest = function(_url,_method,_backFunction){
this.createXMLHttpRequest();
//在每个连接后面加个随机数
var random = Math.round(Math.random()*10000);
_url = (_url.indexOf('?')>0)?(_url+='&random='+random):(_url+='?random='+random);
_xmlHttp.open(_method, _url, false);
_xmlHttp.send(null);
_xmlHttp.onreadystatechange = this.backFunction(_backFunction);
}
}

用法:
自己定义一个处理ajax 返回xml 的js方法: 例如
function backFunction(xmlObj){
......
}

调用
var url = "...";
var method = "GET";
new Ajax().ajaxRequest(url,method,backFunction);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: