ACMer博客瀑布流是一個專門收集ACMer博客並展現的站點。地址http://blog.acmicpc.info/php
打開網頁以後直接查看源代碼發現html
function entry2html(entry) { var html = ''; html += '<div class="box" id="entry-' + entry.rss_entry_id + '">'; html += '<div class="entry-title">'; html += '<a onclick="click_entry(' + entry.rss_entry_id + ')" href="' + entry.link + '" target="_blank">' + entry.title + '</a>'; html += '</div>'; html += '<div class="entry-time">'; html += entry.crawled; html += '</div>'; html += '<div class="entry-author">'; html += '<a href="' + entry.author_link + '" target="_blank"> '; html += entry.author_name; html += '</a>'; html += '</div>'; html += '<div class="entry-summary">'; html += entry.summary; html += '</div>'; html += '<div style="float:right;">'; html += ' <span style="cursor:pointer" onclick="like_entry(' + entry.rss_entry_id + ')"><i class="icon-heart"></i>喜歡(<span class="like_num">' + entry.like + '</span>)</span> '; html += '</div>'; html += '<div style="float:left;">'; html += ' <span><i class="icon-search"></i><span class="click_num">' + entry.click + '</span>人閱讀</span> '; html += '</div>'; html += '</div>'; return html; }
很明顯,網頁中的html代碼都是由這個函數來生成的。再搜索一下源代碼中什麼地方調用的這個函數。ajax
function append_entries() { if (stop) return; $('#load-entry-tip').show(); $.ajax( { dataType : 'json', url : 'ajax_entry.php?from=' + from, success : function(data) { var html = ''; // alert(data); $('#load-entry-tip').hide(); if (data.length == 0) { stop = true; $('#load-entry-tip').html('您看得太多了,休息會吧'); $('#load-entry-tip').show(); return; } $.each(data, function(i, entry) { html += entry2html(entry); }) var dboxes = $(html); $('div#container').append(dboxes).masonry('appended', dboxes); scroll_lock = false; } }) from = from + 1; }
在這裏面出現了$.ajax()方法,很明顯html頁面就是經過調用$.ajax()去向後臺接口獲取數據的。json
因而就暴露出了後臺接口的地址了app
url : 'ajax_entry.php?from=' + from,
整理一下就是ide
http://blog.acmicpc.info/ajax_entry.php?from=0