日期:2014-05-20  浏览次数:20707 次

jquery1.4.2 升级为jquery1.7.1,并使用lhgdialog4.x后,ajax有问题
我的jsp,原来是使用jquery1.4.2,jquery.plugins.js,jquery.flex.alert.js
现升级为升级为jquery1.7.1,并使用lhgdialog4.x后,json格式的ajax出问题
出来的对话框没文字.原来 $.flexalert.show的方式是可以显示出transport.resMsg的值的,现在显示不出来.
action:
  if(msg==null || msg.equals("") )
{
 
msg = "{'msg':null,'resMsg':'"+resMsg+"'}";
}  
else
{
msg = "{'msg':'"+msg+"','resMsg':'"+resMsg+"'}";
}
  this.printOut(response, msg);
  Jsp页面:
  $.ajax({
url: "<%=request.getContextPath() %>/restrict_editResValidate.action",
type: "POST", data: "workId="+workId+"&restrictInfo.resType="+resType+"&restrictInfo.resDate="+resDate,
dataType:'json',
success: function(transport){
  $.dialog({ id:"d_transportmsgId",lock:true,parent:this,
time: 60, title:"提示",
content:transport.msg,max:false,min:false
};
  }
  else
  {
  $.dialog({ id:"d_editRestrictId",
parent : this, 
lock:true,
title : "提示", 
min:false,
max:false,
content: transport.resMsg,  
ok: function(){ 
$("#preWorkForm").submit();  
  }, 
cancelVal: '取消', 
cancel: true 
});  
}

 

------解决方案--------------------
"{'msg':null,'resMsg':'"+resMsg+"'}";

请严格遵守 

key-value 时候 都使用 “” 而不是‘’