通过上一篇的JAVA操做后,全部必要的属性已加进新的 jsonobject 中, 而且是字符串,css
利用 JS eval() 将 该字符串转为 JS 对象html
var receiptPolicyListArray = eval('<%=receiptPolicyList%>'); //注意: alert(eval("{}"); -> return undefined // alert(eval("({})"); -> return object[Object]
初始化微回执页面json
//找到选择的微回执 var receiptPolicy; for ( p in receiptPolicyListArray) { if(receiptPolicyListArray[p].policyNo=='<%=policyNo%>'){ receiptPolicy=receiptPolicyListArray[p]; break; } } //alert(receiptPolicyListArray[p].applyName + "\n" + receiptPolicyListArray[p].insName + "\n" + rece//iptPolicyListArray[p].policyNo); //初始化页面 showReceiptPage(receiptPolicy); //初始化函数 function showReceiptPage(receiptPolicy){ //当已经签的回执receiptPolicyNum不等于 $("#yes").src = "<%=request.getContextPath()%>/globaleNew/images/service/checkboxred.png"; $("#no").src= "<%=request.getContextPath()%>/globaleNew/images/service/checkboxred.png"; if(receiptPolicyNum!=receiptPolicyListArray.length){ $("#tipsYanZheng").css({"display": "none"}); $("#yanzhengCodeId").css({"display": "none"}); } if(receiptPolicy.templateFlag=="A"){ $("#policyNoId").html(receiptPolicy.policyNo); $("#policyNoId2").html(receiptPolicy.policyNo); $("#applyNameId").html(receiptPolicy.applyName); $("#insNameId").html(receiptPolicy.insName); $("#tsalesdscId").html(receiptPolicy.tsalesdsc); $("#agntnameId").html(receiptPolicy.agntname); $("#agntnumId").html(receiptPolicy.agntnum); $("#applyNameId2").html(receiptPolicy.applyName); $("#phoneNumId").html(receiptPolicy.phoneNum); $("#yinxiaoId").html("营销服务部:"); $("#yinxiaoyuanId").html("营销员:"); $("#yinxiaoyuanNumId").html("营销员号码:"); var thankHtmlA = "<p> 很是感谢您...</p>"; thankHtmlA +="<p> 您的...</p>"; thankHtmlA +="<p> 特别提示您,在您收到...</p>"; $("#thankInfo").html(thankHtmlA); var noteHtmlA = "<p>本人已收到...</p>"; $("#knowInfo").html(noteHtmlA); } if(receiptPolicy.templateFlag=="B"){ ... } ... }