Skip to content

Instantly share code, notes, and snippets.

@deniscsz
Created August 13, 2012 19:05
Show Gist options
  • Save deniscsz/3343299 to your computer and use it in GitHub Desktop.
Save deniscsz/3343299 to your computer and use it in GitHub Desktop.
if($("#shipping_postcode").size() > 0) {
$(document).ready(function(){
GER_localizacao = 'http://www.vacamarela.com/lojadoamigo/'
$("#shipping_postcode").keyup(function(){
resultado = GER_localizacao+'webservices.php?cep='+$(this).val();
if($(this).val().length > 7){
$.ajax({
url:resultado,
type:'GET',
dataType: 'xml',
success:function(respostaCEP){
respostaCEP2 = eval(respostaCEP);
$(respostaCEP2).find('webservicecep').each(function(){
$("#shipping_street1").val($(this).find('tipo_logradouro').text()+' '+$(this).find('logradouro').text()+' - '+$(this).find('bairro').text());
//$("#ClienteBairro").val($(this).find('bairro').text());
$("#shipping_city").val($(this).find('cidade').text());
$("#shipping_region").val($(this).find('uf').text());
});
}
});
}
});
});
}
if($("#billing_postcode").size() > 0) {
$(document).ready(function(){
GER_localizacao = 'http://www.vacamarela.com/lojadoamigo/'
$("#billing_postcode").keyup(function(){
resultado = GER_localizacao+'webservices.php?cep='+$(this).val();
if($(this).val().length > 7){
$.ajax({
url:resultado,
type:'GET',
dataType: 'xml',
success:function(respostaCEP){
respostaCEP2 = eval(respostaCEP);
$(respostaCEP2).find('webservicecep').each(function(){
$("#billing_street1").val($(this).find('tipo_logradouro').text()+' '+$(this).find('logradouro').text()+' - '+$(this).find('bairro').text());
//$("#ClienteBairro").val($(this).find('bairro').text());
$("#billing_city").val($(this).find('cidade').text());
$("#billing_region").val($(this).find('uf').text());
});
}
});
}
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment