{"action":"created","comment":{"url":"https://api.github.com/repos/mauriciogbl/startup/pulls/comments/83001740","pull_request_review_id":3864771,"id":83001740,"diff_hunk":"@@ -0,0 +1,75 @@\n+//EXERCISE 6\n+  function eventRequest() {\n+    var xhttp = new XMLHttpRequest();\n+    xhttp.open('GET', 'http://api.icndb.com/jokes/random', true);\n+    xhttp.onreadystatechange = function(event) {\n+      var response = JSON.parse(event.target.response);\n+      document.getElementById('sectionHidden').innerHTML = response.value.joke;\n+       if (xhttp.readyState === XMLHttpRequest.DONE) {\n+         if (xhttp.responseText.value) {\n+             document.getElementById(\"buttonSection\").innerHTML  = xhttp.responseText.value.joke;\n+         }\n+       }\n+   }\n+   xhttp.send();\n+}\n+//EXERCISE 7\n+function eventOnClick(){\n+  var config = {\n+    url: 'http://api.icndb.com/jokes/random'\n+};\n+  function resolve(xhttp) {\n+    console.log(xhttp.responseText);\n+    var response = JSON.parse(event.target.response);\n+    document.getElementById('sectionHidden').innerHTML = response.value.joke;\n+};\n+  function reject() {\n+    alert('Something went wrong !');\n+    document.getElementById(\"sectionHidden\").style.color = \"red\";\n+};\n+  eventRequestReusable(config).then(resolve,reject);\n+};\n+//EXERCISE 9\n+function secondEventOnClick(){\n+  var config = {\n+    url: 'https://api.github.com/search/repositories'\n+};\n+  function resolve(xhttp) {\n+    console.log(xhttp.responseText);\n+    var response = JSON.parse(event.target.response);\n+    document.getElementById('sectionHidden').innerHTML = response.errors[0].field;\n+};\n+  function reject() {\n+    alert('Something went wrong !');\n+    document.getElementById(\"sectionHidden\").style.color = \"red\";\n+};\n+  eventRequestReusable(config).then(resolve,reject);\n+\n+};\n+//EXERCISE 7 AND 9\n+function eventRequestReusable(object, resolve, reject) {\n+  return new Promise( function (resolve, reject) {\n+  var xhttp = new XMLHttpRequest();\n+  xhttp.open('GET', object.url , true);\n+  xhttp.send();\n+  xhttp.onload = function () {\n+    if (this.status == 200 || this.status == 422) {\n+      resolve(xhttp);\n+    } else {\n+      reject();\n+    }\n+  };\n+  xhttp.onerror = function () {\n+    document.getElementById(\"sectionHidden\").style.backgroundColor = \"red\";;\n+    reject();\n+  };\n+})\n+};\n+\n+// if (xhttp.readyState === XMLHttpRequest.DONE)","path":"01-JS-DOM-APIs/exerciseJS.js","position":69,"original_position":69,"commit_id":"2db1458da74306bfe5a33c926e4e7ab3b0083585","original_commit_id":"2db1458da74306bfe5a33c926e4e7ab3b0083585","user":{"login":"afiorenza","id":9002162,"avatar_url":"https://avatars.githubusercontent.com/u/9002162?v=3","gravatar_id":"","url":"https://api.github.com/users/afiorenza","html_url":"https://github.com/afiorenza","followers_url":"https://api.github.com/users/afiorenza/followers","following_url":"https://api.github.com/users/afiorenza/following{/other_user}","gists_url":"https://api.github.com/users/afiorenza/gists{/gist_id}","starred_url":"https://api.github.com/users/afiorenza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/afiorenza/subscriptions","organizations_url":"https://api.github.com/users/afiorenza/orgs","repos_url":"https://api.github.com/users/afiorenza/repos","events_url":"https://api.github.com/users/afiorenza/events{/privacy}","received_events_url":"https://api.github.com/users/afiorenza/received_events","type":"User","site_admin":false},"body":"If you are not going to use this code you could delete it","created_at":"2016-10-12T13:15:52Z","updated_at":"2016-10-12T13:21:08Z","html_url":"https://github.com/mauriciogbl/startup/pull/2#discussion_r83001740","pull_request_url":"https://api.github.com/repos/mauriciogbl/startup/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/mauriciogbl/startup/pulls/comments/83001740"},"html":{"href":"https://github.com/mauriciogbl/startup/pull/2#discussion_r83001740"},"pull_request":{"href":"https://api.github.com/repos/mauriciogbl/startup/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/mauriciogbl/startup/pulls/2","id":88910651,"html_url":"https://github.com/mauriciogbl/startup/pull/2","diff_url":"https://github.com/mauriciogbl/startup/pull/2.diff","patch_url":"https://github.com/mauriciogbl/startup/pull/2.patch","issue_url":"https://api.github.com/repos/mauriciogbl/startup/issues/2","number":2,"state":"open","locked":false,"title":"Topic1","user":{"login":"mauriciogbl","id":22548752,"avatar_url":"https://avatars.githubusercontent.com/u/22548752?v=3","gravatar_id":"","url":"https://api.github.com/users/mauriciogbl","html_url":"https://github.com/mauriciogbl","followers_url":"https://api.github.com/users/mauriciogbl/followers","following_url":"https://api.github.com/users/mauriciogbl/following{/other_user}","gists_url":"https://api.github.com/users/mauriciogbl/gists{/gist_id}","starred_url":"https://api.github.com/users/mauriciogbl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mauriciogbl/subscriptions","organizations_url":"https://api.github.com/users/mauriciogbl/orgs","repos_url":"https://api.github.com/users/mauriciogbl/repos","events_url":"https://api.github.com/users/mauriciogbl/events{/privacy}","received_events_url":"https://api.github.com/users/mauriciogbl/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-10-11T21:02:19Z","updated_at":"2016-10-12T13:21:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c7646ca4372cbc27af7c3b15b7a40d16cc438b1a","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/mauriciogbl/startup/pulls/2/commits","review_comments_url":"https://api.github.com/repos/mauriciogbl/startup/pulls/2/comments","review_comment_url":"https://api.github.com/repos/mauriciogbl/startup/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mauriciogbl/startup/issues/2/comments","statuses_url":"https://api.github.com/repos/mauriciogbl/startup/statuses/2db1458da74306bfe5a33c926e4e7ab3b0083585","head":{"label":"mauriciogbl:Topic1","ref":"Topic1","sha":"2db1458da74306bfe5a33c926e4e7ab3b0083585","user":{"login":"mauriciogbl","id":22548752,"avatar_url":"https://avatars.githubusercontent.com/u/22548752?v=3","gravatar_id":"","url":"https://api.github.com/users/mauriciogbl","html_url":"https://github.com/mauriciogbl","followers_url":"https://api.github.com/users/mauriciogbl/followers","following_url":"https://api.github.com/users/mauriciogbl/following{/other_user}","gists_url":"https://api.github.com/users/mauriciogbl/gists{/gist_id}","starred_url":"https://api.github.com/users/mauriciogbl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mauriciogbl/subscriptions","organizations_url":"https://api.github.com/users/mauriciogbl/orgs","repos_url":"https://api.github.com/users/mauriciogbl/repos","events_url":"https://api.github.com/users/mauriciogbl/events{/privacy}","received_events_url":"https://api.github.com/users/mauriciogbl/received_events","type":"User","site_admin":false},"repo":{"id":69690052,"name":"startup","full_name":"mauriciogbl/startup","owner":{"login":"mauriciogbl","id":22548752,"avatar_url":"https://avatars.githubusercontent.com/u/22548752?v=3","gravatar_id":"","url":"https://api.github.com/users/mauriciogbl","html_url":"https://github.com/mauriciogbl","followers_url":"https://api.github.com/users/mauriciogbl/followers","following_url":"https://api.github.com/users/mauriciogbl/following{/other_user}","gists_url":"https://api.github.com/users/mauriciogbl/gists{/gist_id}","starred_url":"https://api.github.com/users/mauriciogbl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mauriciogbl/subscriptions","organizations_url":"https://api.github.com/users/mauriciogbl/orgs","repos_url":"https://api.github.com/users/mauriciogbl/repos","events_url":"https://api.github.com/users/mauriciogbl/events{/privacy}","received_events_url":"https://api.github.com/users/mauriciogbl/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mauriciogbl/startup","description":"Basic folder structure","fork":true,"url":"https://api.github.com/repos/mauriciogbl/startup","forks_url":"https://api.github.com/repos/mauriciogbl/startup/forks","keys_url":"https://api.github.com/repos/mauriciogbl/startup/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mauriciogbl/startup/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mauriciogbl/startup/teams","hooks_url":"https://api.github.com/repos/mauriciogbl/startup/hooks","issue_events_url":"https://api.github.com/repos/mauriciogbl/startup/issues/events{/number}","events_url":"https://api.github.com/repos/mauriciogbl/startup/events","assignees_url":"https://api.github.com/repos/mauriciogbl/startup/assignees{/user}","branches_url":"https://api.github.com/repos/mauriciogbl/startup/branches{/branch}","tags_url":"https://api.github.com/repos/mauriciogbl/startup/tags","blobs_url":"https://api.github.com/repos/mauriciogbl/startup/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mauriciogbl/startup/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mauriciogbl/startup/git/refs{/sha}","trees_url":"https://api.github.com/repos/mauriciogbl/startup/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mauriciogbl/startup/statuses/{sha}","languages_url":"https://api.github.com/repos/mauriciogbl/startup/languages","stargazers_url":"https://api.github.com/repos/mauriciogbl/startup/stargazers","contributors_url":"https://api.github.com/repos/mauriciogbl/startup/contributors","subscribers_url":"https://api.github.com/repos/mauriciogbl/startup/subscribers","subscription_url":"https://api.github.com/repos/mauriciogbl/startup/subscription","commits_url":"https://api.github.com/repos/mauriciogbl/startup/commits{/sha}","git_commits_url":"https://api.github.com/repos/mauriciogbl/startup/git/commits{/sha}","comments_url":"https://api.github.com/repos/mauriciogbl/startup/comments{/number}","issue_comment_url":"https://api.github.com/repos/mauriciogbl/startup/issues/comments{/number}","contents_url":"https://api.github.com/repos/mauriciogbl/startup/contents/{+path}","compare_url":"https://api.github.com/repos/mauriciogbl/startup/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mauriciogbl/startup/merges","archive_url":"https://api.github.com/repos/mauriciogbl/startup/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mauriciogbl/startup/downloads","issues_url":"https://api.github.com/repos/mauriciogbl/startup/issues{/number}","pulls_url":"https://api.github.com/repos/mauriciogbl/startup/pulls{/number}","milestones_url":"https://api.github.com/repos/mauriciogbl/startup/milestones{/number}","notifications_url":"https://api.github.com/repos/mauriciogbl/startup/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mauriciogbl/startup/labels{/name}","releases_url":"https://api.github.com/repos/mauriciogbl/startup/releases{/id}","deployments_url":"https://api.github.com/repos/mauriciogbl/startup/deployments","created_at":"2016-09-30T18:07:35Z","updated_at":"2016-10-07T16:31:04Z","pushed_at":"2016-10-11T21:02:19Z","git_url":"git://github.com/mauriciogbl/startup.git","ssh_url":"git@github.com:mauriciogbl/startup.git","clone_url":"https://github.com/mauriciogbl/startup.git","svn_url":"https://github.com/mauriciogbl/startup","homepage":null,"size":10316,"stargazers_count":0,"watchers_count":0,"language":"HTML","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"mauriciogbl:master","ref":"master","sha":"97ff40867560d29900c260f9526cc0038eb5414f","user":{"login":"mauriciogbl","id":22548752,"avatar_url":"https://avatars.githubusercontent.com/u/22548752?v=3","gravatar_id":"","url":"https://api.github.com/users/mauriciogbl","html_url":"https://github.com/mauriciogbl","followers_url":"https://api.github.com/users/mauriciogbl/followers","following_url":"https://api.github.com/users/mauriciogbl/following{/other_user}","gists_url":"https://api.github.com/users/mauriciogbl/gists{/gist_id}","starred_url":"https://api.github.com/users/mauriciogbl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mauriciogbl/subscriptions","organizations_url":"https://api.github.com/users/mauriciogbl/orgs","repos_url":"https://api.github.com/users/mauriciogbl/repos","events_url":"https://api.github.com/users/mauriciogbl/events{/privacy}","received_events_url":"https://api.github.com/users/mauriciogbl/received_events","type":"User","site_admin":false},"repo":{"id":69690052,"name":"startup","full_name":"mauriciogbl/startup","owner":{"login":"mauriciogbl","id":22548752,"avatar_url":"https://avatars.githubusercontent.com/u/22548752?v=3","gravatar_id":"","url":"https://api.github.com/users/mauriciogbl","html_url":"https://github.com/mauriciogbl","followers_url":"https://api.github.com/users/mauriciogbl/followers","following_url":"https://api.github.com/users/mauriciogbl/following{/other_user}","gists_url":"https://api.github.com/users/mauriciogbl/gists{/gist_id}","starred_url":"https://api.github.com/users/mauriciogbl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mauriciogbl/subscriptions","organizations_url":"https://api.github.com/users/mauriciogbl/orgs","repos_url":"https://api.github.com/users/mauriciogbl/repos","events_url":"https://api.github.com/users/mauriciogbl/events{/privacy}","received_events_url":"https://api.github.com/users/mauriciogbl/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mauriciogbl/startup","description":"Basic folder structure","fork":true,"url":"https://api.github.com/repos/mauriciogbl/startup","forks_url":"https://api.github.com/repos/mauriciogbl/startup/forks","keys_url":"https://api.github.com/repos/mauriciogbl/startup/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mauriciogbl/startup/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mauriciogbl/startup/teams","hooks_url":"https://api.github.com/repos/mauriciogbl/startup/hooks","issue_events_url":"https://api.github.com/repos/mauriciogbl/startup/issues/events{/number}","events_url":"https://api.github.com/repos/mauriciogbl/startup/events","assignees_url":"https://api.github.com/repos/mauriciogbl/startup/assignees{/user}","branches_url":"https://api.github.com/repos/mauriciogbl/startup/branches{/branch}","tags_url":"https://api.github.com/repos/mauriciogbl/startup/tags","blobs_url":"https://api.github.com/repos/mauriciogbl/startup/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mauriciogbl/startup/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mauriciogbl/startup/git/refs{/sha}","trees_url":"https://api.github.com/repos/mauriciogbl/startup/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mauriciogbl/startup/statuses/{sha}","languages_url":"https://api.github.com/repos/mauriciogbl/startup/languages","stargazers_url":"https://api.github.com/repos/mauriciogbl/startup/stargazers","contributors_url":"https://api.github.com/repos/mauriciogbl/startup/contributors","subscribers_url":"https://api.github.com/repos/mauriciogbl/startup/subscribers","subscription_url":"https://api.github.com/repos/mauriciogbl/startup/subscription","commits_url":"https://api.github.com/repos/mauriciogbl/startup/commits{/sha}","git_commits_url":"https://api.github.com/repos/mauriciogbl/startup/git/commits{/sha}","comments_url":"https://api.github.com/repos/mauriciogbl/startup/comments{/number}","issue_comment_url":"https://api.github.com/repos/mauriciogbl/startup/issues/comments{/number}","contents_url":"https://api.github.com/repos/mauriciogbl/startup/contents/{+path}","compare_url":"https://api.github.com/repos/mauriciogbl/startup/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mauriciogbl/startup/merges","archive_url":"https://api.github.com/repos/mauriciogbl/startup/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mauriciogbl/startup/downloads","issues_url":"https://api.github.com/repos/mauriciogbl/startup/issues{/number}","pulls_url":"https://api.github.com/repos/mauriciogbl/startup/pulls{/number}","milestones_url":"https://api.github.com/repos/mauriciogbl/startup/milestones{/number}","notifications_url":"https://api.github.com/repos/mauriciogbl/startup/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mauriciogbl/startup/labels{/name}","releases_url":"https://api.github.com/repos/mauriciogbl/startup/releases{/id}","deployments_url":"https://api.github.com/repos/mauriciogbl/startup/deployments","created_at":"2016-09-30T18:07:35Z","updated_at":"2016-10-07T16:31:04Z","pushed_at":"2016-10-11T21:02:19Z","git_url":"git://github.com/mauriciogbl/startup.git","ssh_url":"git@github.com:mauriciogbl/startup.git","clone_url":"https://github.com/mauriciogbl/startup.git","svn_url":"https://github.com/mauriciogbl/startup","homepage":null,"size":10316,"stargazers_count":0,"watchers_count":0,"language":"HTML","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mauriciogbl/startup/pulls/2"},"html":{"href":"https://github.com/mauriciogbl/startup/pull/2"},"issue":{"href":"https://api.github.com/repos/mauriciogbl/startup/issues/2"},"comments":{"href":"https://api.github.com/repos/mauriciogbl/startup/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/mauriciogbl/startup/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/mauriciogbl/startup/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mauriciogbl/startup/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/mauriciogbl/startup/statuses/2db1458da74306bfe5a33c926e4e7ab3b0083585"}}}}
{"actor":{"display_login":"afiorenza"}}