<!-- 生成课件 -->
<action name="createCourseware" class="coursewareManagementAction" method="createCourseware">
<result name="ajax" type="jsonmessage">
<param name="message">message</param>
</result>
</action>
$.ajax({
url: "<s:url value='/childmanagement/changeChildUserIdInSession.action'/>",
type: "post",
async:true,
data:{userId:userId},
dataType: "json",
contentType:"application/x-www-form-urlencoded; charset=UTF-8" , //
success: function( rtnValue ){
if(rtnValue.message == "true" ){
//
location.reload(true);
//
$("#child_link").find("span").html(userName);
$("#child_link").find("span").attr("childId", userId);
}
},
error: function(reqObj, strError, strObj){
alert("程序出现错误:" + strError);
}
});
//load方法得替代实现
$(".ranking_refresh_btn").click(function(){
var schoolClassId = '${schoolClassId}';
$.ajax({
url: "<c:url value='/personalindex/getStudyTimeList.action'/>",
type: "post",
async:true,
data:{schoolClassId:schoolClassId},
success: function( response ){
$(".studyTimeRank").empty();
$(".studyTimeRank").append(response);
},
error: function(reqObj, strError, strObj){
//未做处理
}
});
});
function showFindBug(){
art.dialog.open("/customerservice/showFindBugDialog.action",{
id: 'feedBackDialog',
title: '',
width:540,
height:390,
lock: true
});
}
-------------------------------------------------ajax 返回json对象------------------------------------------------
<!-- ajax 获取课表内容 -->
<action name="ajaxGetTimetableContent" class="timetableAction" method="ajaxGetTimetableContent">
<result name="ajax" type="json">
<param name="include">timetableContentList</param>
</result>
</action>
$("#weekSelect").change(function(){
var yearWeekString = $(this).val();
$.ajax({
url: "<s:url value='/timetable/ajaxGetTimetableContent.action'/>",
type: "post",
data:{yearWeekString:yearWeekString},
dataType: "json",
contentType:"application/x-www-form-urlencoded; charset=UTF-8" , //防止中文乱码
success: function( rtnValue ){
$("td[id]").empty();
$(rtnValue).each(function(){
var content = $("#oneContentSample").clone();
var dayOfWeekCourseIndex = this.dayOfWeekCourseIndexString;
var classScheduleId = this.id;
if( classScheduleId == null || classScheduleId == "" ){
content.find(".oneContentShow").hide();
}
else{
content.attr("schoolClassId", this.schoolClassId);
content.attr("classScheduleId", classScheduleId);
var displayName = classDisplayName(this.grade, this.schoolClassName);
//Content用于显示
content.find(".oneContentShow").children("span").html(displayName);
//[备课]or[授课]
if( this.preparedLesson == true ){
//已经备课了,直接授课
var descObj = content.find(".oneContentShow").find("span.teach");
descObj.html("授课");
descObj.attr("state","lesson");
}
//Content用于编辑
content.find(".oneContentEdit>div>span").html(displayName);
}
content.show();
content.attr("id", dayOfWeekCourseIndex+"Div");
$("#"+dayOfWeekCourseIndex).append(content);
});
},
error: function(reqObj, strError, strObj){
alert("程序出现错误:" + strError);
}
});
});
================================
================================
<!-- ajax 课表选择班级 -->
<action name="ajaxCourseSelectSchoolClass" class="timetableAction" method="ajaxCourseSelectSchoolClass">
<result name="ajax" type="json">
<param name="include">timetableContentVo</param>
</result>
</action>
//选择班级[确认]
$(".buttonConfirm").die().live("click",function(){
var classScheduleId = lastContentObj.attr("classScheduleId");
var schoolClassId = $("#selectClassId").val();
var yearWeekString = $("#weekSelect").val();
var dayOfWeekCourseIndexString = lastContentObj.parent("td").attr("id");
var forceUpdate = $("#timetable_selectClass").find(".centerClassDialog").children(".showMessages").is(":hidden") ? false : true;
$.ajax({
url: "<s:url value='/timetable/ajaxCourseSelectSchoolClass.action'/>",
type: "post",
data:{classScheduleId:classScheduleId, schoolClassId:schoolClassId,
yearWeekString:yearWeekString, dayOfWeekCourseIndexString:dayOfWeekCourseIndexString,forceUpdate:forceUpdate},
dataType: "json",
contentType:"application/x-www-form-urlencoded; charset=UTF-8" , //防止中文乱码
success: function( rtnValue ){
if( rtnValue.message == null || rtnValue.message =="" ){
lastContentObj.attr("classScheduleId", rtnValue.classScheduleId);
lastContentObj.attr("schoolClassId", rtnValue.schoolClassId);
//...
}
else{
if( rtnValue.message == "confirm" ){
$("#timetable_selectClass").find(".centerClassDialog").children("div").hide();
$("#timetable_selectClass").find(".centerClassDialog").children(".showMessages").show();
return;
}
}
//隐藏[清空班级]option
$("#timetable_selectClass").find(".selectStyleClass>option").each(function(){
if( $(this).val() == "remove_class"){
$(this).hide();
}
});
//关闭对话框
dialogObj.close();
},
error: function(reqObj, strError, strObj){
alert("程序出现错误:" + strError);
}
});
});
-------------------------------------------------ajax 返回json对象------------------------------------------------
//加载转圈图
<img class="loading" src="/images/loading_icon.gif"/>
//加载swf文件
<div id="waitForLoading" class="wait_for_loading" style="position:relative;top:50px;display:none;">
<img src="<c:url value='/images/studyreport/baobao.gif'/>" style="position:absolute;"/>
<img src="<c:url value='/images/studyreport/cycle_1.png'/>" style="position:absolute;left: 170px;top: 70px;"/>
<img src="<c:url value='/images/studyreport/cycle_2.png'/>" style="position:absolute;left: 185px;top: 40px;"/>
<img src="<c:url value='/images/studyreport/cycle_3.png'/>" style="position:absolute;width:203px;height:88px;top: -40px;left: 200px;"/>
<span style="position:absolute;left: 225px;top: -10px;">慧话宝宝正在努力加载中......</span>
<span style="position:absolute;left: 270px;top: 10px;">请耐心等候</span>
<object type="application/x-shockwave-flash" data="<c:url value='/images/studyreport/loading.swf'/>" style="position: absolute;left: 220px;top: 100px;height: 60px;"/>
</div>
//JS性能测试用
var _startMonitorTime = 0;
var _endMonitorTime=0;
//打印用时
function printMointor( msg ){
var secondTime = (_endMonitorTime-_startMonitorTime)/1000;
console.info(msg + secondTime);
}
_startMonitorTime = new Date().getTime();
_endMonitorTime = new Date().getTime();
printMointor("加载HTML用时:");