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();