一、异步加载立即报名
$(function(){
$(".loginbtn").click(function(){
var dislog=art.dialog({
title:'立即报名',
content:$("#loginform").html(),
lock:true,
opacity:0.4,
fixed:true,
init:function(){
$("#btnSubmit").click(function(){
var param = {
company : $("#company").val(),
contacts:$("#contacts").val(),
plancity:$("#plancity").val(),
tel:$("#tel").val(),
mobile:$("#mobile").val(),
email:$("#email").val(),
address:$("#address").val()
};
if(beforeApplay()){
$.post("/home/apply/save",param,function(data){
if(data=="1")
{
art.dialog({ content: '恭喜您!已报名成功!', lock: true, opacity: 0.2, time: 3, close: function () { window.location.reload(); } })
}
else
{
art.dialog({ title:'提示信息', content: '对不起!报名失败!', lock: true, opacity: 0.2, time: 3, close: function () { window.location.reload(); } })
}
})
}
})
}
})
})
})
二、异步刷新模块
<script type="text/javascript">
$(document).ready(function(){
$("#ajaxNotice").html("<li>loading..</li>");
$("#ajaxNotice").load('/home/right/getNotice');
});
</script>
三、html代码中根据变量加载模块(右侧栏)
<!-- 公告 -->
<c:if test="${pageName!='notice'}">
<div class="con_div pb_8 he_292">
<h2 class="h2_tit">公告</h2>
<div class="div_main">
<ul class="list_ul" id="ajaxNotice">
</ul>
</div>
<!--div_main end-->
</div>
<!--con_div end-->
</c:if>
在页面中定义变量并复制
<%
request.setAttribute("pageName", "home");
%>
菜单中使用
<c:if test="${pageName=='home'}">
<c:set var="homeClass" value="cur" />
</c:if>
<c:if test="${pageName=='about'}">
<c:set var="aboutClass" value="cur" />
</c:if>
<li><a href="${request.contextPath}/home.shtml" class="${homeClass}">首页</a></li>
<li><a href="${request.contextPath}/home/about/about.shtml" class="${aboutClass }">关于腾计划</a></li>