-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsoup_version.js
More file actions
27 lines (26 loc) · 1.11 KB
/
soup_version.js
File metadata and controls
27 lines (26 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
$(document).ready(function(){
var users = [];
$('.form').submit(function(event){
event.preventDefault();
var username = $(this).serialize().split('=')[1];
$.ajax({
url: 'https://api.github.com/users/' + username,
type: 'get',
dataType: 'json'
}).done(function(response){
var user = { name: response.name,
username: response.username,
login: response.login,
email: response.email,
avatar: response.avatar_url,
repos: response.public_repos
};
users << user;
$('.jumbotron').append("<div id='"+ user.name +"'><h1>" + user.name + "</h1><p>" + user.username +"</p><p>" +user.email+ "</p><p>Repos: " + user.repos+ "</p><img src='"+ user.avatar +"' alt='github image' height='300' width='300'</img> </div>");
}).fail(function(response){
console.log("FAILBOAT, SET SAIL!");
}).always(function(response){
console.log("Le Fin.")
});
})
});