From add0dd9bba7f246049e51633cae0cde6676be189 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 22 Jan 2019 15:05:38 +0800 Subject: [PATCH] 1 --- chapter2/mysite/myapp/static/scripts/index.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/chapter2/mysite/myapp/static/scripts/index.js b/chapter2/mysite/myapp/static/scripts/index.js index 47f7f9d..021807f 100755 --- a/chapter2/mysite/myapp/static/scripts/index.js +++ b/chapter2/mysite/myapp/static/scripts/index.js @@ -9,14 +9,16 @@ $(function(){ //更新抓取信息 setInterval(function(){ $.ajax('/myapp/api/news.json').done(function(datas){ - for(var i in datas){ + for(var i =0; i < datas.length; ++i){ var data = datas[i]; - console.log(i); + + $('#tr_news_'+i+' .news_comment_id').html(data.fields.comment_id); + $('#tr_news_'+i+' .news_content').html(data.fields.content); + $('#tr_news_'+i+' .news_comment_time').html(data.fields.comment_time); } }); $.ajax('/myapp/api/crawl_info.json').done(function(data){ - console.log(data); $('#crawl_info_total_count').html(data.total_count); $('#crawl_info_today_count').html(data.today_total_count); $('#crawl_info_product_count').html(data.product_count); @@ -32,7 +34,7 @@ $(function(){ $('#mem_used').html(to_g(data.mem_used)+'G'); $('#tasks_count').html(data.tasks); }); - }, 1500); + }, 3000); init(); init2();