日期:2014-05-17 浏览次数:20543 次
$("#RESUME_WORK_save").bind("click",function(){//例如触发条件是RESUME_WORK_save的点击 也可以根据滚动条高度发送ajax请求调用数据等
var work_data="data=jsondate&.....";//post数据提交
$.ajax({
type:"POST",
url:"xxx.php",//需要提交页面
data:work_data,
beforeSend:function(){
$(this).attr("disabled",true).val("请求中");
},
success:function(data){
var jsonresult=JSON.parse(data);//这里可以对拿回的数据进行组装成div,将该div插入或者任意其他处理方式将他放到div容器中。例如id worklist的容器 可以看看jquery帮助文档各种插入方式都有。
var divbox="<div>xxx</div>";
/*
内部插入
append(content
------解决方案--------------------
fn)
appendTo(content)
prepend(content
------解决方案--------------------
fn)
prependTo(content)
外部插入
after(content
------解决方案--------------------
fn)
before(content
------解决方案--------------------
fn)
insertAfter(content)
insertBefore(content)
*/
$("#worklist").after(divbox);//worklist之后插入divbox 可以实现动态载入。
}
});
});
var dt = '{"data":[{"commentid":"1","weiboid":"47","uid":"100001","content":"34535","datetime":"1350355452","syncid":"0","synctype":"0","replayuid":"0","replaycid":"0"},{"commentid":"2","weiboid":"47","uid":"100000","content":"34535","datetime":"1350355456","syncid":"0","synctype":"0","replayuid":"0","replaycid":"0"},{"commentid":"3","weiboid":"47","uid":"10016","content":"34535","datetime":"1350355471","syncid":"0","synctype":"0","replayuid":"0","replaycid":"0"},{"commentid":"37","weiboid":"47","uid":"100000","content":"656321","datetime":"1350355517","syncid":"0","synctype":"0","replayuid":"0","replaycid":"0"}],"total_rows":4}';
var json = eval('(' + dt + ')');
$(json.data).each(function(i, item){
alert(item.commentid)
})