Jqury回调

动作:

function saveDefault(ptid){

  var httpRequest;
  httpRequest = $.get("<%=request.getContextPath()%>/play/playList.do?do=savePlayTime&id="+ptid+"&startTime="+starttime+"&endTime="+endtime+"","",function(){saveHourOk("stateHour_"+ptid,httpRequest)});}

处理:

httpRequest为回调部分

 

前面请求部分返回处理为:out.print("success");

不要用out.println(),不然出错;

CallBack:

function saveHourOk(id,httpRequest){
  var message=httpRequest.responseText;
  alert(message);
  alert(id);
  if(message=="true"){
   showMsg(id,"<bean:message key='playTempletList.view.save'/>");
   }else{
   showMsg(id,"<bean:message key='playTempletList.view.savefalse'/>");
   }
  miss(id);
}

 

//返回信息
function showMsg(id,msg){
 show(id);
 var obj = document.getElementById(id);
 obj.innerHTML = msg;

 miss(id);
 
}

 

//消失吧
function miss(id){
 window.setTimeout(function(){$("#"+id).fadeOut('slow')},4000);
 //window.setTimeout(function(){hide(id)},3000);
}

你可能感兴趣的:(bean)