Created
February 23, 2013 13:17
-
-
Save alexcurtis/5019692 to your computer and use it in GitHub Desktop.
Before JQuery Promises Refactoring
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Get Services For id | |
function GetServices(id) { | |
//Get Popular Services | |
var popularServiceUrl = PopularServiceUrl(id); | |
$.getJSON(popularServiceUrl, {}, function (data) { | |
var pservices = {}; | |
var services = {}; | |
$(data).each(function() { | |
CreatePopularService(this, function(service) { | |
//... | |
}); | |
}); | |
//Get Category Services | |
var categoryServiceUrl = CategoryServiceUrl(id); | |
$.getJSON(categoryServiceUrl, {}, function (data) { | |
$(data).each(function () { | |
CreateService(this, function(service) { | |
//... | |
}); | |
}); | |
PostProcessService(pservices); | |
PostProcessService(services); | |
ShowResults(); | |
}).error(function () { ShowErrorDialog(); }); | |
}).error(function () { ShowErrorDialog(); }); | |
} | |
function PostProcessService(service) { | |
//... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment