{"action":"created","comment":{"url":"https://api.github.com/repos/jscho13/jumper/pulls/comments/49631230","id":49631230,"diff_hunk":"@@ -0,0 +1,49 @@\n+var makeAjaxRequestUpPost = function(reviewButtonTo, venueID, reviewId, voteType) {\n+  var request = $.ajax({\n+    method: 'PATCH',\n+    data: { up: voteType },\n+    url: '/api/venues/' + venueID + '/reviews/' + reviewId\n+  });\n+\n+  request.done(function(data) {\n+    var review = $('#review-' + data.id)[0]\n+    review.getElementsByClassName(\"helpful\")[0].innerHTML = \"Helpful: \" + data.revup_count\n+    review.getElementsByClassName(\"not-helpful\")[0].innerHTML = \"Not Helpful: \" + data.revdown_count\n+  });\n+};\n+\n+var makeAjaxRequestDownPost = function(reviewButtonTo, venueID, reviewId, voteType) {\n+  var request = $.ajax({\n+    method: 'PATCH',\n+    data: { down: voteType },\n+    url: '/api/venues/' + venueID + '/reviews/' + reviewId\n+  });\n+\n+  request.done(function(data) {\n+    var review = $('#review-' + data.id)[0]\n+    review.getElementsByClassName(\"helpful\")[0].innerHTML = \"Helpful: \" + data.revup_count\n+    review.getElementsByClassName(\"not-helpful\")[0].innerHTML = \"Not Helpful: \" + data.revdown_count\n+  });\n+};\n+\n+$('#upvote').on('click', function(event) {\n+    event.preventDefault();\n+    var reviewButton = event.target;\n+    var venueId = reviewButton.baseURI.match(/^(.*?)(\\d+)(\\D*)$/)[2];\n+    var reviewButtonTo = $(reviewButton).closest('.button_to');\n+    var reviewId = $(reviewButtonTo).attr('action').match(/\\/(\\d+)\\//)[1];","path":"app/assets/javascripts/vote.js","position":34,"original_position":34,"commit_id":"7ba0f087e35472b8e5de30721b9d56559a3127bb","original_commit_id":"7ba0f087e35472b8e5de30721b9d56559a3127bb","user":{"login":"davidrf","id":9678182,"avatar_url":"https://avatars.githubusercontent.com/u/9678182?v=3","gravatar_id":"","url":"https://api.github.com/users/davidrf","html_url":"https://github.com/davidrf","followers_url":"https://api.github.com/users/davidrf/followers","following_url":"https://api.github.com/users/davidrf/following{/other_user}","gists_url":"https://api.github.com/users/davidrf/gists{/gist_id}","starred_url":"https://api.github.com/users/davidrf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidrf/subscriptions","organizations_url":"https://api.github.com/users/davidrf/orgs","repos_url":"https://api.github.com/users/davidrf/repos","events_url":"https://api.github.com/users/davidrf/events{/privacy}","received_events_url":"https://api.github.com/users/davidrf/received_events","type":"User","site_admin":false},"body":"You can get to the reviewId based on the reviewButtons url. Something along the lines of this\r\n\r\nreviewButton.find(\"button\").attr(\"href\").split(\"/\")[5]","created_at":"2016-01-13T18:43:09Z","updated_at":"2016-01-13T18:43:09Z","html_url":"https://github.com/jscho13/jumper/pull/27#discussion_r49631230","pull_request_url":"https://api.github.com/repos/jscho13/jumper/pulls/27","_links":{"self":{"href":"https://api.github.com/repos/jscho13/jumper/pulls/comments/49631230"},"html":{"href":"https://github.com/jscho13/jumper/pull/27#discussion_r49631230"},"pull_request":{"href":"https://api.github.com/repos/jscho13/jumper/pulls/27"}}},"pull_request":{"url":"https://api.github.com/repos/jscho13/jumper/pulls/27","id":55919722,"html_url":"https://github.com/jscho13/jumper/pull/27","diff_url":"https://github.com/jscho13/jumper/pull/27.diff","patch_url":"https://github.com/jscho13/jumper/pull/27.patch","issue_url":"https://api.github.com/repos/jscho13/jumper/issues/27","number":27,"state":"open","locked":false,"title":"Ajax votes","user":{"login":"fletch-mkii","id":14324473,"avatar_url":"https://avatars.githubusercontent.com/u/14324473?v=3","gravatar_id":"","url":"https://api.github.com/users/fletch-mkii","html_url":"https://github.com/fletch-mkii","followers_url":"https://api.github.com/users/fletch-mkii/followers","following_url":"https://api.github.com/users/fletch-mkii/following{/other_user}","gists_url":"https://api.github.com/users/fletch-mkii/gists{/gist_id}","starred_url":"https://api.github.com/users/fletch-mkii/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fletch-mkii/subscriptions","organizations_url":"https://api.github.com/users/fletch-mkii/orgs","repos_url":"https://api.github.com/users/fletch-mkii/repos","events_url":"https://api.github.com/users/fletch-mkii/events{/privacy}","received_events_url":"https://api.github.com/users/fletch-mkii/received_events","type":"User","site_admin":false},"body":"With and without javascript for voting. ","created_at":"2016-01-13T16:23:20Z","updated_at":"2016-01-13T18:43:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5ab2fca841644fd3c3b266892ae487962f57221e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jscho13/jumper/pulls/27/commits","review_comments_url":"https://api.github.com/repos/jscho13/jumper/pulls/27/comments","review_comment_url":"https://api.github.com/repos/jscho13/jumper/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jscho13/jumper/issues/27/comments","statuses_url":"https://api.github.com/repos/jscho13/jumper/statuses/7ba0f087e35472b8e5de30721b9d56559a3127bb","head":{"label":"jscho13:ajax_votes","ref":"ajax_votes","sha":"7ba0f087e35472b8e5de30721b9d56559a3127bb","user":{"login":"jscho13","id":8882123,"avatar_url":"https://avatars.githubusercontent.com/u/8882123?v=3","gravatar_id":"","url":"https://api.github.com/users/jscho13","html_url":"https://github.com/jscho13","followers_url":"https://api.github.com/users/jscho13/followers","following_url":"https://api.github.com/users/jscho13/following{/other_user}","gists_url":"https://api.github.com/users/jscho13/gists{/gist_id}","starred_url":"https://api.github.com/users/jscho13/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jscho13/subscriptions","organizations_url":"https://api.github.com/users/jscho13/orgs","repos_url":"https://api.github.com/users/jscho13/repos","events_url":"https://api.github.com/users/jscho13/events{/privacy}","received_events_url":"https://api.github.com/users/jscho13/received_events","type":"User","site_admin":false},"repo":{"id":49005277,"name":"jumper","full_name":"jscho13/jumper","owner":{"login":"jscho13","id":8882123,"avatar_url":"https://avatars.githubusercontent.com/u/8882123?v=3","gravatar_id":"","url":"https://api.github.com/users/jscho13","html_url":"https://github.com/jscho13","followers_url":"https://api.github.com/users/jscho13/followers","following_url":"https://api.github.com/users/jscho13/following{/other_user}","gists_url":"https://api.github.com/users/jscho13/gists{/gist_id}","starred_url":"https://api.github.com/users/jscho13/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jscho13/subscriptions","organizations_url":"https://api.github.com/users/jscho13/orgs","repos_url":"https://api.github.com/users/jscho13/repos","events_url":"https://api.github.com/users/jscho13/events{/privacy}","received_events_url":"https://api.github.com/users/jscho13/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jscho13/jumper","description":"Launch Academy Group Project","fork":false,"url":"https://api.github.com/repos/jscho13/jumper","forks_url":"https://api.github.com/repos/jscho13/jumper/forks","keys_url":"https://api.github.com/repos/jscho13/jumper/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jscho13/jumper/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jscho13/jumper/teams","hooks_url":"https://api.github.com/repos/jscho13/jumper/hooks","issue_events_url":"https://api.github.com/repos/jscho13/jumper/issues/events{/number}","events_url":"https://api.github.com/repos/jscho13/jumper/events","assignees_url":"https://api.github.com/repos/jscho13/jumper/assignees{/user}","branches_url":"https://api.github.com/repos/jscho13/jumper/branches{/branch}","tags_url":"https://api.github.com/repos/jscho13/jumper/tags","blobs_url":"https://api.github.com/repos/jscho13/jumper/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jscho13/jumper/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jscho13/jumper/git/refs{/sha}","trees_url":"https://api.github.com/repos/jscho13/jumper/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jscho13/jumper/statuses/{sha}","languages_url":"https://api.github.com/repos/jscho13/jumper/languages","stargazers_url":"https://api.github.com/repos/jscho13/jumper/stargazers","contributors_url":"https://api.github.com/repos/jscho13/jumper/contributors","subscribers_url":"https://api.github.com/repos/jscho13/jumper/subscribers","subscription_url":"https://api.github.com/repos/jscho13/jumper/subscription","commits_url":"https://api.github.com/repos/jscho13/jumper/commits{/sha}","git_commits_url":"https://api.github.com/repos/jscho13/jumper/git/commits{/sha}","comments_url":"https://api.github.com/repos/jscho13/jumper/comments{/number}","issue_comment_url":"https://api.github.com/repos/jscho13/jumper/issues/comments{/number}","contents_url":"https://api.github.com/repos/jscho13/jumper/contents/{+path}","compare_url":"https://api.github.com/repos/jscho13/jumper/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jscho13/jumper/merges","archive_url":"https://api.github.com/repos/jscho13/jumper/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jscho13/jumper/downloads","issues_url":"https://api.github.com/repos/jscho13/jumper/issues{/number}","pulls_url":"https://api.github.com/repos/jscho13/jumper/pulls{/number}","milestones_url":"https://api.github.com/repos/jscho13/jumper/milestones{/number}","notifications_url":"https://api.github.com/repos/jscho13/jumper/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jscho13/jumper/labels{/name}","releases_url":"https://api.github.com/repos/jscho13/jumper/releases{/id}","created_at":"2016-01-04T15:25:08Z","updated_at":"2016-01-11T16:53:15Z","pushed_at":"2016-01-13T16:51:32Z","git_url":"git://github.com/jscho13/jumper.git","ssh_url":"git@github.com:jscho13/jumper.git","clone_url":"https://github.com/jscho13/jumper.git","svn_url":"https://github.com/jscho13/jumper","homepage":"","size":471,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"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":1,"default_branch":"master"}},"base":{"label":"jscho13:master","ref":"master","sha":"f116f79e16adf92ac1594c829a34a3863a0204da","user":{"login":"jscho13","id":8882123,"avatar_url":"https://avatars.githubusercontent.com/u/8882123?v=3","gravatar_id":"","url":"https://api.github.com/users/jscho13","html_url":"https://github.com/jscho13","followers_url":"https://api.github.com/users/jscho13/followers","following_url":"https://api.github.com/users/jscho13/following{/other_user}","gists_url":"https://api.github.com/users/jscho13/gists{/gist_id}","starred_url":"https://api.github.com/users/jscho13/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jscho13/subscriptions","organizations_url":"https://api.github.com/users/jscho13/orgs","repos_url":"https://api.github.com/users/jscho13/repos","events_url":"https://api.github.com/users/jscho13/events{/privacy}","received_events_url":"https://api.github.com/users/jscho13/received_events","type":"User","site_admin":false},"repo":{"id":49005277,"name":"jumper","full_name":"jscho13/jumper","owner":{"login":"jscho13","id":8882123,"avatar_url":"https://avatars.githubusercontent.com/u/8882123?v=3","gravatar_id":"","url":"https://api.github.com/users/jscho13","html_url":"https://github.com/jscho13","followers_url":"https://api.github.com/users/jscho13/followers","following_url":"https://api.github.com/users/jscho13/following{/other_user}","gists_url":"https://api.github.com/users/jscho13/gists{/gist_id}","starred_url":"https://api.github.com/users/jscho13/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jscho13/subscriptions","organizations_url":"https://api.github.com/users/jscho13/orgs","repos_url":"https://api.github.com/users/jscho13/repos","events_url":"https://api.github.com/users/jscho13/events{/privacy}","received_events_url":"https://api.github.com/users/jscho13/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jscho13/jumper","description":"Launch Academy Group Project","fork":false,"url":"https://api.github.com/repos/jscho13/jumper","forks_url":"https://api.github.com/repos/jscho13/jumper/forks","keys_url":"https://api.github.com/repos/jscho13/jumper/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jscho13/jumper/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jscho13/jumper/teams","hooks_url":"https://api.github.com/repos/jscho13/jumper/hooks","issue_events_url":"https://api.github.com/repos/jscho13/jumper/issues/events{/number}","events_url":"https://api.github.com/repos/jscho13/jumper/events","assignees_url":"https://api.github.com/repos/jscho13/jumper/assignees{/user}","branches_url":"https://api.github.com/repos/jscho13/jumper/branches{/branch}","tags_url":"https://api.github.com/repos/jscho13/jumper/tags","blobs_url":"https://api.github.com/repos/jscho13/jumper/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jscho13/jumper/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jscho13/jumper/git/refs{/sha}","trees_url":"https://api.github.com/repos/jscho13/jumper/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jscho13/jumper/statuses/{sha}","languages_url":"https://api.github.com/repos/jscho13/jumper/languages","stargazers_url":"https://api.github.com/repos/jscho13/jumper/stargazers","contributors_url":"https://api.github.com/repos/jscho13/jumper/contributors","subscribers_url":"https://api.github.com/repos/jscho13/jumper/subscribers","subscription_url":"https://api.github.com/repos/jscho13/jumper/subscription","commits_url":"https://api.github.com/repos/jscho13/jumper/commits{/sha}","git_commits_url":"https://api.github.com/repos/jscho13/jumper/git/commits{/sha}","comments_url":"https://api.github.com/repos/jscho13/jumper/comments{/number}","issue_comment_url":"https://api.github.com/repos/jscho13/jumper/issues/comments{/number}","contents_url":"https://api.github.com/repos/jscho13/jumper/contents/{+path}","compare_url":"https://api.github.com/repos/jscho13/jumper/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jscho13/jumper/merges","archive_url":"https://api.github.com/repos/jscho13/jumper/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jscho13/jumper/downloads","issues_url":"https://api.github.com/repos/jscho13/jumper/issues{/number}","pulls_url":"https://api.github.com/repos/jscho13/jumper/pulls{/number}","milestones_url":"https://api.github.com/repos/jscho13/jumper/milestones{/number}","notifications_url":"https://api.github.com/repos/jscho13/jumper/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jscho13/jumper/labels{/name}","releases_url":"https://api.github.com/repos/jscho13/jumper/releases{/id}","created_at":"2016-01-04T15:25:08Z","updated_at":"2016-01-11T16:53:15Z","pushed_at":"2016-01-13T16:51:32Z","git_url":"git://github.com/jscho13/jumper.git","ssh_url":"git@github.com:jscho13/jumper.git","clone_url":"https://github.com/jscho13/jumper.git","svn_url":"https://github.com/jscho13/jumper","homepage":"","size":471,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"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":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jscho13/jumper/pulls/27"},"html":{"href":"https://github.com/jscho13/jumper/pull/27"},"issue":{"href":"https://api.github.com/repos/jscho13/jumper/issues/27"},"comments":{"href":"https://api.github.com/repos/jscho13/jumper/issues/27/comments"},"review_comments":{"href":"https://api.github.com/repos/jscho13/jumper/pulls/27/comments"},"review_comment":{"href":"https://api.github.com/repos/jscho13/jumper/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jscho13/jumper/pulls/27/commits"},"statuses":{"href":"https://api.github.com/repos/jscho13/jumper/statuses/7ba0f087e35472b8e5de30721b9d56559a3127bb"}}}}