这是一篇记录文字:
用的是thinkphp
html code:
[code]
<div id="press-in">
loading…
</div>
[/code]
js code:
[code lang=”js”]
<script>
jQuery(function(){
jQuery("#press-in").load("/cityosweb/default.php/shanmao/wppress .press-recent-mk",function(){
jQuery("#press-in").append(‘<span style="float:right;margin-right:10px;cursor:pointer;margin-bottom:100px" class="ckm">Click More</span>’);
});
var i =1;
jQuery(".ckm").live("click",function(){
jQuery(this).remove();
jQuery.getJSON("/cityosweb/default.php/shanmao/wppress_json",{page:i},function(data){
if(data.status==1){
var str = "";
jQuery.each(data.data,function(index,array){
var str ="<span class=’press-recent-mk’><span class=’press-recent-name-box’><span class=\"press-recent-mk-tx\"><img align=\"absmiddle\" src=’"+array[‘ico’]+"’> </span><span class=’press-recent-mk-nanme’>"+array[‘website’]+"</span><span class=’press-recent-mk-date’>"+array[‘time’]+"</span></span><span class=’press-recent-mk-title’> <a href=’"+array[‘url’]+"’ target=’_blank’ rel=’nofollow’>"+array[‘title’]+"</a></span><span class=’press-recent-mk-txt’>\""+array[‘dis’]+"\" </span></span>";
jQuery("#press-in").append(str);
});
jQuery("#press-in").append(‘<span style="float:right;margin-right:10px;cursor:pointer;margin-bottom:100px" class="ckm">Click More</span>’);
i++;
}else{
jQuery("#press-in").append(‘<span style="float:right;margin-right:10px;cursor:pointer;margin-bottom:100px" class="">End</span>’);
}
});
});
})
</script>
[/code]
php code:
[code lang=”php”]
function wppress_json(){
$wp = M(‘Wppress’);
$input = $_GET[‘page’];
$start = $input*5;
$list = $wp->limit("$start,5")->order("time desc")->select();
//$list[‘time’]=1;
/*
foreach ($list as $key=>$val){
foreach ($val as $key2=>$val2){
if($key2=="time"){
$list[‘key’][‘key2’]=date("Y-m-d",$val2);
}
//dump($list[‘key’][‘key2′]);
}
}
dump($list);*/
if($list){
$this->ajaxReturn($list,’success’,1);
}else{
$this->error(‘data empty!’);
}
}
function wppress(){
import(‘ORG.Util.Page’);
$wp = M(‘Wppress’);
$count= $wp->count();
$page = new Page($count,5);
$showpage = $page->show();
$list = $wp->limit($page->firstRow.’,’.$page->listRows)->order("time desc")->select();
//dump($list);
$this->assign(‘page’,$showpage);
$this->assign(‘aa’,$list);
$this->display(‘shanmao/wppress.html’);
}
[/code]
有个jQuery 插件 jquery.more.js
demo:http://www.helloweba.com/demo/more/
爱建街
o