Skip to main content
removeu 8 caracteres do conteúdo
Fonte Link
Venatci
  • 354
  • 2
  • 7

Faço conformeSegue o exemplo abaixo:

try{
    xmlhttp = new XMLHttpRequest();
}catch(ee){
    try{
        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    }catch(e){
        try{
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }catch(E){
            xmlhttp = false;
        }
    }
}

function pegarCep( CEP ){
    if( CEP.length==0) return false;
    var divCep = document.getElementById('divCep');
    divCep.innerHTML = "Carregando...";
    xmlhttp.open("GET", "/cadastro-sms/br/cep.asp?CEP="+ CEP,true);
    xmlhttp.onreadystatechange=function() {
        if (xmlhttp.readyState==4){
            var resposta = xmlhttp.responseText;
            divCep.innerHTML = resposta;
        }
    }
    xmlhttp.send(null);             
}

Faço conforme o exemplo abaixo:

try{
    xmlhttp = new XMLHttpRequest();
}catch(ee){
    try{
        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    }catch(e){
        try{
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }catch(E){
            xmlhttp = false;
        }
    }
}

function pegarCep( CEP ){
    if( CEP.length==0) return false;
    var divCep = document.getElementById('divCep');
    divCep.innerHTML = "Carregando...";
    xmlhttp.open("GET", "/cadastro-sms/br/cep.asp?CEP="+ CEP,true);
    xmlhttp.onreadystatechange=function() {
        if (xmlhttp.readyState==4){
            var resposta = xmlhttp.responseText;
            divCep.innerHTML = resposta;
        }
    }
    xmlhttp.send(null);             
}

Segue o exemplo abaixo:

try{
    xmlhttp = new XMLHttpRequest();
}catch(ee){
    try{
        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    }catch(e){
        try{
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }catch(E){
            xmlhttp = false;
        }
    }
}

function pegarCep( CEP ){
    if( CEP.length==0) return false;
    var divCep = document.getElementById('divCep');
    divCep.innerHTML = "Carregando...";
    xmlhttp.open("GET", "/cadastro-sms/br/cep.asp?CEP="+ CEP,true);
    xmlhttp.onreadystatechange=function() {
        if (xmlhttp.readyState==4){
            var resposta = xmlhttp.responseText;
            divCep.innerHTML = resposta;
        }
    }
    xmlhttp.send(null);             
}
formatando texto e removendo textos desnecessários
Fonte Link
Math
  • 31,3mil
  • 15
  • 95
  • 132

Há uns 6 anos eu faziaFaço conforme o exemplo abaixo:

        try{
            xmlhttp = new XMLHttpRequest();
        }catch(ee){
            try{
                xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
            }catch(e){
                try{
                    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                }catch(E){
                    xmlhttp = false;
                }
            }
        }
        
                    
        function pegarCep( CEP ){
                
                if( CEP.length==0) return false;
                
                var divCep = document.getElementById('divCep');
                divCep.innerHTML = "Carregando..."
                ";
                xmlhttp.open("GET", "/cadastro-sms/br/cep.asp?CEP="+ CEP,true);
                xmlhttp.onreadystatechange=function() {
                    if (xmlhttp.readyState==4){
                        var resposta = xmlhttp.responseText;
                        divCep.innerHTML = resposta;
                    }
                }
                xmlhttp.send(null);             
        }

Há uns 6 anos eu fazia conforme o exemplo abaixo:

        try{
            xmlhttp = new XMLHttpRequest();
        }catch(ee){
            try{
                xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
            }catch(e){
                try{
                    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                }catch(E){
                    xmlhttp = false;
                }
            }
        }
        
                    
        function pegarCep( CEP ){
                
                if( CEP.length==0) return false;
                
                var divCep = document.getElementById('divCep');
                divCep.innerHTML = "Carregando..."
                
                xmlhttp.open("GET", "/cadastro-sms/br/cep.asp?CEP="+ CEP,true);
                xmlhttp.onreadystatechange=function() {
                    if (xmlhttp.readyState==4){
                        var resposta = xmlhttp.responseText;
                        divCep.innerHTML = resposta;
                    }
                }
                xmlhttp.send(null);             
        }

Faço conforme o exemplo abaixo:

try{
    xmlhttp = new XMLHttpRequest();
}catch(ee){
    try{
        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    }catch(e){
        try{
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }catch(E){
            xmlhttp = false;
        }
    }
}

function pegarCep( CEP ){
    if( CEP.length==0) return false;
    var divCep = document.getElementById('divCep');
    divCep.innerHTML = "Carregando...";
    xmlhttp.open("GET", "/cadastro-sms/br/cep.asp?CEP="+ CEP,true);
    xmlhttp.onreadystatechange=function() {
        if (xmlhttp.readyState==4){
            var resposta = xmlhttp.responseText;
            divCep.innerHTML = resposta;
        }
    }
    xmlhttp.send(null);             
}
Fonte Link
Venatci
  • 354
  • 2
  • 7

Há uns 6 anos eu fazia conforme o exemplo abaixo:

        try{
            xmlhttp = new XMLHttpRequest();
        }catch(ee){
            try{
                xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
            }catch(e){
                try{
                    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                }catch(E){
                    xmlhttp = false;
                }
            }
        }
        
                    
        function pegarCep( CEP ){
                
                if( CEP.length==0) return false;
                
                var divCep = document.getElementById('divCep');
                divCep.innerHTML = "Carregando..."
                
                xmlhttp.open("GET", "/cadastro-sms/br/cep.asp?CEP="+ CEP,true);
                xmlhttp.onreadystatechange=function() {
                    if (xmlhttp.readyState==4){
                        var resposta = xmlhttp.responseText;
                        divCep.innerHTML = resposta;
                    }
                }
                xmlhttp.send(null);             
        }