From d428e5d92073141f8e1c8add0d5e914e9ca97d4b Mon Sep 17 00:00:00 2001 From: imbenclifford Date: Fri, 26 Sep 2014 12:36:56 +0000 Subject: [PATCH] made js faster --- css/guardianstyling.scss | 1 + js/application.js | 22 +++++++++------------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/css/guardianstyling.scss b/css/guardianstyling.scss index 0d685b9..f612b2d 100644 --- a/css/guardianstyling.scss +++ b/css/guardianstyling.scss @@ -10,6 +10,7 @@ .tab-content { list-style-type:none; + font-size: 14px; } .gtableline:nth-child(odd) { diff --git a/js/application.js b/js/application.js index 68e3103..2c9db30 100644 --- a/js/application.js +++ b/js/application.js @@ -1,23 +1,19 @@ $( document ).ready(function() { - var fillNews=function(sect){ - $.ajax({ - url: "http://content.guardianapis.com/search?api-key=test&show-fields=all&order-by=newest§ion=" + sect, success: function(data) { - for(var i=0; i<5; i++) { - - var str = '
  • '+'' + - data.response.results[i].webTitle + "" + - data.response.results[i].fields.trailText.substr(0,130)+"..." + '
  • ' - - $( "#" + sect ).append(str); + var str = ''; + for(var i=0; i<5; i++) { + str += '
  • ' + '' + + data.response.results[i].webTitle + "" + + data.response.results[i].fields.trailText.substr(0,130) + "..." + '
  • '; } - } + $( "#" + sect ).append(str); + } }); }; fillNews("football");