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);
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);
相关文章推荐
- phpmailer 发送邮件,利用公司邮箱服务器
- phpmailer 实现发送邮件
- PHP正则表达式获取武汉市的实时pm2.5数据并邮件发送phpmailer
- phpmailer发送邮件,可以带附件
- PHPMailer使用QQ邮箱实现邮件发送功能
- phpmailer邮件发送 错误 :SMTP Error: Could not authenticate.
- Php 中用phpmailer发送邮件
- php 邮件发送利器 PHPMailer
- phpmailer发送邮件出现错误:stream_socket_enable_crypto(): SSL operation failed with code 1.
- PHPMailer发送邮件demo示例
- 简单测试PHPMailer发送邮件
- PHPMailer发送邮件
- PHPMailer 发送邮件示例代码
- 用phpmailer发送邮件提示SMTP Error: Could not connect to SMTP host解决办法
- PHP Mailer邮件发送失败发送失败! Mailer Error: SMTP connect() failed.
- PHPMailer发送邮件失败:SMTP connect failed
- phpmailer发送邮件
- PHPMailer发送邮件
- 高效的PHP邮件发送库:Swiftmailer