screw jquery
This commit is contained in:
parent
d9e060e25c
commit
1f67ea6ea9
2 changed files with 27 additions and 11 deletions
|
@ -1,19 +1,36 @@
|
||||||
$.getJSON 'https://zeus.ugent.be/game/top4/show.json', (data) ->
|
request = new XMLHttpRequest
|
||||||
|
request.open 'GET', 'https://zeus.ugent.be/game/top4/show.json', true
|
||||||
|
|
||||||
|
request.onload = ->
|
||||||
|
if request.status >= 200 and request.status < 400
|
||||||
|
# Success!
|
||||||
|
data = JSON.parse(request.responseText)
|
||||||
|
|
||||||
str = "<table>"
|
str = "<table>"
|
||||||
for x in data
|
for x in data
|
||||||
str += """
|
str += """
|
||||||
<tr>
|
<tr>
|
||||||
<td class="picture">
|
<td class="picture">
|
||||||
<img class="coder-picture" src="#{x.avatar_url}">
|
<img class="coder-picture" src="#{x.avatar_url}">
|
||||||
</td>
|
</td>
|
||||||
<td class="name">
|
<td class="name">
|
||||||
<a class="coder-name" href="#{x.github_url}">#{x.github_name}</a>
|
<a class="coder-name" href="#{x.github_url}">#{x.github_name}</a>
|
||||||
</td>
|
</td>
|
||||||
<td class="score">
|
<td class="score">
|
||||||
#{x.score}
|
#{x.score}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
"""
|
"""
|
||||||
str += "</table>"
|
str += "</table>"
|
||||||
|
|
||||||
$('#gamification-coders').html(str)
|
el = document.getElementById('gamification-coders')
|
||||||
|
el.innerHTML = str
|
||||||
|
else
|
||||||
|
# We reached our target server, but it returned an error
|
||||||
|
return
|
||||||
|
|
||||||
|
request.onerror = ->
|
||||||
|
# There was a connection error of some sort
|
||||||
|
return
|
||||||
|
|
||||||
|
request.send()
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% content_for :scripts do %>
|
<% content_for :scripts do %>
|
||||||
<script src="https://code.jquery.com/jquery-3.0.0.min.js" charset="utf-8"></script>
|
|
||||||
<%= asset :js, :gamification %>
|
<%= asset :js, :gamification %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue