首先在Action中将ques对象放进Json对象中
JSONObject obj = new JSONObject();
obj.put("quesid",ques.get("quesid").toString());obj.put("content",ques.get("content").toString());
obj.put("options",ques.get("options").toString());
obj.put("answer",this.parseXml(ques.get("answer").toString()).toString());
obj.put("uanswers",uanswers);
obj.put("quesType",ques.get("type").toString());
log.info(obj.toString());
setJsonString(obj.toString());
return JSON_RESULT;
$.getJSON("${base}/exam/test!answerQuestion.action",{"examId":examId,"type":type,"answeredNum":answeredNum,"examUserId":examUserId,"answer":answers,"quesId":quesid},function(data){ //赋值 $("#buffer").text(""); quesid=data['quesid']; $("#resources_ce3_content_test_left_center_1 span p").html("第 "+(answeredNum+1)+" 题"); var content=$("#buffer").text(data['content']).html(); $("#resources_ce3_content_test_left_center_2 span p").html(content); quesType=data['quesType']; //解析xml格式的试题选项 options=data['options']; //解析xml格式的试题答案 uanswers=data['uanswers']; //alert("试题答案"+uanswers); var str=loadXML(options); var ops = str.getElementsByTagName("o"); 。。。。省略
原文链接:https://www.f2er.com/ajax/166070.html