Skip to content

Instantly share code, notes, and snippets.

@k33g
Created July 29, 2012 12:08
Show Gist options
  • Save k33g/3198230 to your computer and use it in GitHub Desktop.
Save k33g/3198230 to your computer and use it in GitHub Desktop.
async
search : function (keyword, pagesInfo, callback) {
Gh3.Users.users = [];
Gh3.Helper.callHttpApi({
service : "legacy/user/search/"+keyword,
data : pagesInfo,
//beforeSend: function (xhr) { xhr.setRequestHeader ("rel", paginationInfo); },
success : function(res) {
_.each(res.data.users, function (user) {
Gh3.Users.users.push(new Gh3.User(user.login, user));
});
if (callback) callback(null, Gh3.Users);
},
error : function (res) {
if (callback) callback(new Error(res));
}
});
},
Gh3.Users.search("mad", {start_page : 3}, function (err, response) {
if(err) {
throw "outch ..."
}
//console.log(Gh3.Users.getAll());
console.log(response.getAll());
response.each(function (user) {
console.log(user.name, user.login, user.repos, user)
users.append(
$('<li>').append(user.login +"("+user.name+") : "+user.language)
);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment