ajax之xmlhttp
<script type="text/javascript" language="javascript">
<!--
//以xml求取数据
function xmlpost(theemail)
{
var webfileurl = "../user/checkuser.aspx?logonname=" + theemail;
var result = "";
if (window.activexobject) {
xmlhttp = new activexobject("microsoft.xmlhttp");
}
else if (window.xmlhttprequest) {
xmlhttp = new xmlhttprequest();
}
//var xmlhttp = new activexobject("msxml2.xmlhttp");
xmlhttp.open("post", webfileurl, false);
xmlhttp.setrequestheader("content-type","application/x-www-form-urlencoded");
xmlhttp.send("");
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readystate==4)
{
result = xmlhttp.responsetext;
}
}
if(xmlhttp.status!=200)
{
alert ('网络故障(xmlhttp.status='+xmlhttp.status+'),请稍后再试!');
}
result = xmlhttp.responsetext;
result = result.substring(0,result.indexof("?ex"));
if(result != "false")
{
return true;
}
else
{
return false;
}
}
//-->
</script>''' <summary>''' 检测用户是否存在<文件名:../user/checkuser.aspx>''' </summary>'''
<remarks>created by dzh @2006/06/27 18:22</remarks>partial class web_user_checkuser
inherits system.web.ui.page
protected sub page_load(byval sender as object, byval e as system.eventargs) handles me.load
if request.querystring("logonname") is nothing then
response.write("false" + "?ex")
response.end()
exit sub
end if
if (new easyclick.easybusiness.userbusiness).getuserbylogonname(request.querystring("logonname").tostring) is nothing then
response.write("false" + "?ex")
response.end()
exit sub
else
response.write("true" + "?ex")
response.end()
exit sub
end if
end subend class
以上就是ajax之xmlhttp的内容。