一个Ajxa问题
function Ajax() {var m_xmlReq = false;
if (window.ActiveXObject) { //判断是否IE浏览器并创建异步对象
try {
m_xmlReq = new ActiveXObject('Msxml2.XMLHTTP');
}
catch (e) {
try {
m_xmlReq = new ActiveXObject('Microsoft.XMLHTTP');
}
catch (e) { }
}
}
else if (window.XMLHttpRequest) {
m_xmlReq = new XMLHttpRequest();
}
this.send = function(Url, send_data, CallBack) {
if (!m_xmlReq) {
return;
}
method = "POST";
m_xmlReq.open(method, Url, true); //加载服务器
if (method == 'POST') {
m_xmlReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded;charset=utf-8');
}
m_xmlReq.onreadystatechange = function() { //关联异步调用方法
if (m_xmlReq.readyState == 4) { //判断异步调用完成
if (m_xmlReq.status == 200) { //判断是否调用成功
CallBack(true, m_xmlReq.responseText);
} else {
CallBack(false);
}
}
}
m_xmlReq.send(send_data.toString()); //发送带参数的请求
}
}
var AjaxObject = new Ajax();
function toLogin() {
var username = document.getElementById("txtName").value;
var pwd = document.getElementById("txtPwd").value;
AjaxObject.send("login.aspx", "username=" + username + "&pwd=" + pwd,
function(succeed, responseUrl) { //绑定回调函数
if (succeed) {
var arr = responseUrl.split("|");
if (arr[0] == 'true') {
document.URL = arr[1]; //设置登录成功后跳转的URL
}
else {
alert("用户名或者密码错误");
}
}
}
);
}
请问大家this.send = function(Url, send_data, CallBack)这句是什么意思,是哪部分的知识,为何我找不到相关的解释。比如 function(Url, send_data, CallBack)这句,我只查到一个“$(selector).load(url,data,callback)”,来之:http://www.
还有 CallBack(true, m_xmlReq.responseText);这句。
以上问题麻烦大家给我解释下,有相关知识链接也可以。不胜感激