通过ajax把参数发送到后台,后台查到数据后写到前台的,如最简单的post方式,
$.post("后台页路径","参数,一般是json格式",function(dd){
//这是回调函数,dd代表还回的数据
})
例子:
index.jsp;
<head>
<script type="text/javascript">
$(function() {
getArticleList("articles",12,{aid:"ccust.about.move",start:"0",offset:"10"});
getMenuList("content");
});
function getArticleList(divid,size,opt){
//获得文章列表
$.post("<%=request.getContextPath()%>/webdo/article/articleListByPage.do",
opt,
function(json){
var str = "";
$("#"+divid).html(str);//清空html内容
var num = json.rows.length;
var aid = "";
if(num>0){
for(var i&#