﻿function createRequest(){
        if(typeof XMLHttpRequest!="undefined")        {
                return new XMLHttpRequest();
        }else if(typeof ActiveXObject!="undefined"){
                var xmlHttp_ver  = false;
                var xmlHttp_vers = ["MSXML2.XmlHttp.5.0","MSXML2.XmlHttp.4.0","MSXML2.XmlHttp.3.0","MSXML2.XmlHttp","Microsoft.XmlHttp"];
                if(!xmlHttp_ver){
                        for(var i=0;i<xmlHttp_vers.length;i++){
                                try{
                                        new ActiveXObject(xmlHttp_vers[i]);
                                        xmlHttp_ver = xmlHttp_vers[i];
                                        break;
                                }catch(oError){;}
                        }
                }
                if(xmlHttp_ver){
                        return new ActiveXObject(xmlHttp_ver);
                }else{
                        throw new Error("Could not create XML HTTP Request.");
                }
        }else{
                throw new Error("Your browser doesn't support an XML HTTP Request.");
        }
}

var xmlHttp;

function sendPostRequest(query_str)
{    
        xmlHttp = createRequest();
        var url = "showa.php";
        var queryString = "id" + "=" + query_str;
        xmlHttp.open("post", url, true);
        xmlHttp.onreadystatechange = showDataz;
        xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;");
        xmlHttp.send(queryString);
}
function showDataz()
{ 
        if(xmlHttp.readyState==4)
        { 
                if(xmlHttp.status==200)
                { 
                        //alert(xmlHttp.responseText);
                    if(xmlHttp.responseText<1)
                        {
                          alert("已经存在此域名！");
                        }
                       else { alert("此域名可以使用！");}
                }
        }
        else
        {

        }
}