function ajax()
{
var xmlhttp=createXMLHttp();
this.url_str='';//php后台文件
this.div_id='';//加载的图层id
this.str='';//传送的数据
this.cc=function()
{
xmlhttp.onreadystatechange=function ()
{
if(xmlhttp.readyState==4)
{
alert(this.str);//注意这边弹出 这边弹出undefine
document.getElementById(this.div_id).innerHTML=xmlhttp.responseText;
document.getElementById("newDrag").style.display="block";
}
}
xmlhttp.open('POST',this.url_str,true);
xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
xmlhttp.send(this.str);
alert(this.str);//这里弹出正常
}
}function character_ajax(user_id,type,mission_id)
{
var aa=new ajax();
aa.url_str='character.php';
aa.div_id="newBody";
aa.str="user_id="+user_id+'&type='+type
aa.cc(); //弹出的是undefine
}
为什么弹出个undefine 要如何解决 先谢谢了
{
var xmlhttp=createXMLHttp();
this.url_str='';//php后台文件
this.div_id='';//加载的图层id
this.str='';//传送的数据
this.cc=function()
{
xmlhttp.onreadystatechange=function ()
{
if(xmlhttp.readyState==4)
{
alert(this.str);//注意这边弹出 这边弹出undefine
document.getElementById(this.div_id).innerHTML=xmlhttp.responseText;
document.getElementById("newDrag").style.display="block";
}
}
xmlhttp.open('POST',this.url_str,true);
xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
xmlhttp.send(this.str);
alert(this.str);//这里弹出正常
}
}function character_ajax(user_id,type,mission_id)
{
var aa=new ajax();
aa.url_str='character.php';
aa.div_id="newBody";
aa.str="user_id="+user_id+'&type='+type
aa.cc(); //弹出的是undefine
}
为什么弹出个undefine 要如何解决 先谢谢了
this.cc=function()
{
var obj = this;
xmlhttp.onreadystatechange=function ()
{
if(xmlhttp.readyState==4)
{
alert(obj.str);//注意这边弹出 这边弹出undefine
document.getElementById(this.div_id).innerHTML=xmlhttp.responseText;
document.getElementById("newDrag").style.display="block";
}
}
xmlhttp.open('POST',this.url_str,true);
xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
xmlhttp.send(this.str);
alert(this.str);//这里弹出正常
} 这样试试
function ajax()
{
var xmlhttp=createXMLHttp();
this.url_str='';//php后台文件
this.div_id='';//加载的图层id
this.str='';//传送的数据
var that = this;
this.cc=function()
{
xmlhttp.onreadystatechange=function ()
{
if(xmlhttp.readyState==4)
{
alert(that.str);//注意这边弹出 这边弹出undefine
document.getElementById(this.div_id).innerHTML=xmlhttp.responseText;
document.getElementById("newDrag").style.display="block";
}
}
xmlhttp.open('POST',this.url_str,true);
xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
xmlhttp.send(this.str);
alert(this.str);//这里弹出正常
}
} function character_ajax(user_id,type,mission_id)
{
var aa=new ajax();
aa.url_str='character.php';
aa.div_id="newBody";
aa.str="user_id="+user_id+'&type='+type
aa.cc(); //弹出的是undefine
}