0
我正在嘗試在我正在構建的Web應用程序中實現加載更多功能。 當應用程序加載時,它會對控制器進行ajax調用,從數據庫中檢索數據,然後使用JSON對它們進行編碼。 我正在使用mysql查詢中的限制和偏移量,並且我將在用戶滾動時加載更多數據。 這是在控制器中的方法,它的Ajax調用到使用json加載更多功能
function latest_pheeds($offset = 0) {
//Confirm if a user is logged before allowing access
if($this->isLogged())
{
//Limit
$limit = 20;
//user id
$user_id = $this->session->userdata('user_id');
//load pheeds
$dt = $this->pheed_model->get_latest_pheeds($limit,$offset);
$data = $dt['pheeds']; //data
$total = $dt['total']; //Total no of rows of data
$return['pheeds'] = $data;
echo json_encode($return); //encode in json
} else {
$this->output->set_status_header('401',"Attempting Unauthorized Access");
}
}
如何打破這一數據到頁面製作,這樣我就可以簡單地通過Ajax調用來實現沒有通過網頁作爲參數傳遞給方法用jQuery加載更多?
如何確定下一個頁面,以便我也可以使用json將它編碼爲jQuery,以便使用 – MrFoh 2012-01-18 22:51:24
現在就讓你知道..你的意思是你怎麼知道下一頁的網址是什麼?那麼'$ next_page_number = $ page + 1' – Kristian 2012-01-18 22:56:38
感謝您的幫助 – MrFoh 2012-01-18 23:11:17