Difference between revisions of "Dev/Results"

(grr. track didn't work. debugging)
(more debugging)
Line 22: Line 22:
  
 
<script>
 
<script>
 
+
var currentYear = 2014;
  
 
//Helper function
 
//Helper function
Line 56: Line 56:
 
for (i = 0; i < arrayOfTeams.length; i++) {
 
for (i = 0; i < arrayOfTeams.length; i++) {
 
var teamObj = jQuery.extend(arrayOfTeams[i], extraTeamInfo[i]);
 
var teamObj = jQuery.extend(arrayOfTeams[i], extraTeamInfo[i]);
console.log(teamObj);
 
 
//Take care of any teams that didn't win any awards
 
//Take care of any teams that didn't win any awards
 
if (teamObj.awards.length == 0) {
 
if (teamObj.awards.length == 0) {
Line 73: Line 72:
  
 
jQuery(document).ready(function() {
 
jQuery(document).ready(function() {
 +
$("#title-year").html(currentYear);
 +
 
//Request team data
 
//Request team data
teamsRequest = jQuery.ajax({
+
var teamsRequest = jQuery.ajax({
 
url: "https://igem.org/aj/team_list.cgi",
 
url: "https://igem.org/aj/team_list.cgi",
 
type: "GET",
 
type: "GET",
 
timeout: 30000,
 
timeout: 30000,
 
dataType: "json",
 
dataType: "json",
data: {command: "get_team_list", year: "2015"}, //**Make this auto-update itself
+
data: {command: "get_team_list", year: currentYear}, //**Make this auto-update itself
 
error: function(jqxhr, textStatus, errorThrown) {
 
error: function(jqxhr, textStatus, errorThrown) {
 
alert("Failed to get list of teams. look at var teamsRequest");
 
alert("Failed to get list of teams. look at var teamsRequest");
Line 85: Line 86:
 
});
 
});
 
//Request the awards data
 
//Request the awards data
awardsRequest = jQuery.ajax({
+
var awardsRequest = jQuery.ajax({
 
url: 'https://igem.org/awards/json_dump.cgi',
 
url: 'https://igem.org/awards/json_dump.cgi',
 
type: 'GET',
 
type: 'GET',
 
timeout: 30000,
 
timeout: 30000,
 
dataType: "json",
 
dataType: "json",
 +
data: {year: currentYear}
 
error: function(jqxhr, textStatus, errorThrown) {
 
error: function(jqxhr, textStatus, errorThrown) {
 
alert("AJAX error; look at var awardsRequest");
 
alert("AJAX error; look at var awardsRequest");
Line 177: Line 179:
  
  
<h2>Comprehensive Results from iGEM 2015</h2>
+
<h2>Comprehensive Results from iGEM <span id="title-year"></span></h2>
  
 
<p>View: <a href="#" id="view-all-teams">[All Teams]</a> <a href="#" id="view-award-winners">[Award Winners]</a> | [Africa] [Asia] [Europe] [Latin America][other?]</p>
 
<p>View: <a href="#" id="view-all-teams">[All Teams]</a> <a href="#" id="view-award-winners">[Award Winners]</a> | [Africa] [Asia] [Europe] [Latin America][other?]</p>

Revision as of 20:38, 23 September 2015

Comprehensive Results from iGEM

View: [All Teams] [Award Winners] | [Africa] [Asia] [Europe] [Latin America][other?]

Team Award