Ajax中使用Json传递数据
来源:互联网 发布:淘宝上有没有微信号卖 编辑:程序博客网 时间:2024/05/02 00:01
首先在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");
。。。。省略
- Ajax中使用Json传递数据
- SpringMVC使用Ajax使用JSON传递数据
- struts2 使用ajax 传递json数据
- Struts2+jQuery,使用ajax传递JSON数据
- Ajax传递Json数据
- Ajax传递json数据
- JAVA中使用JSON进行数据传递
- JAVA中使用JSON进行数据传递
- JAVA中使用JSON进行数据传递
- JAVA中使用JSON进行数据传递
- JAVA中使用JSON进行数据传递
- JAVA中使用JSON进行数据传递
- JAVA中使用JSON进行数据传递
- JAVA中使用JSON进行数据传递
- JAVA中使用JSON进行数据传递
- JAVA中使用JSON进行数据传递
- JAVA中使用JSON进行数据传递
- JAVA中使用JSON进行数据传递
- sqlload的用法
- Android中自定义seekbar样式
- 检测笔记本电脑的主板,cpu,硬盘的温度
- MFC.UI线程问题
- 手把手教你如何识别钓鱼网站
- Ajax中使用Json传递数据
- Android_SharedPreferences用户偏好设置
- UVA 11384 - Help is needed for Dexter
- Linux 下的定时器使用
- 个人重构版机房收费系统事务的使用
- 常用Windows消息、常量命名参考
- protected访问权限
- How to import existing projects into TFS Visual Studio with GIT ?
- MFC寻找按钮事件