Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- controler.common = {
- getCEP1: function(cep){
- return $.getJSON('http://getcep-1/'+cep);
- },
- getCEP2: function(cep){
- return $.getJSON('http://getcep-2'+ cep);
- }
- }
- var ctrlCommon = controllers.common;
- ctrlCommon.getCEP1(cep)
- .always(function(data, xhr){
- if(data.erro || xhr === 'error'){
- ctrlCommon.getCEP2(cep)
- .always(function(data, xhr){
- if(data.cep)
- // sucesso
- else
- // erro
- })
- }
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement