JS使用ajax异步处理json响应数据
来源:互联网 发布:linux下网络配置文件 编辑:程序博客网 时间:2024/04/29 20:16
客户端使用ajax异步请求服务器
$.ajax({ async: true, type: "post", url: "getcode", dataType: "json", success: function(data){ data = data.toString(); $(".code").val(data); }, error: function(xhr){ alert("服务器环境异常-->"+xhr.status); }});
服务器端数据响应代码
@Controllerpublic class Controller{ @RequestMapping("getcode") public void getCode(HttpServletRequest request,HttpServletResponse response){ UUID uuid = uuid.randUUID(); String code = uuid.toString().replace("-",""); HttpSession session = reqeust.getSession(); session.setAttribute("code",code); PrintWriter writer = response.getWriter(); JSONArray jsonarr = new JSONArray(); jsonarr.put(code); writer.print(jsonarr.toString()); }}
阅读全文
0 0
- JS使用ajax异步处理json响应数据
- 详谈 Jquery Ajax 异步处理Json数据.
- 详谈 Jquery Ajax 异步处理Json数据.
- 详谈 Jquery Ajax 异步处理Json数据.
- 详谈 Jquery Ajax异步处理Json数据.
- 详谈 Jquery Ajax 异步处理Json数据.
- 详谈 Jquery Ajax 异步处理Json数据.
- 详谈 JQuery Ajax异步处理Json数据
- 详谈 Jquery Ajax 异步处理Json数据
- 详谈 Jquery Ajax异步处理Json数据
- 详谈 Jquery Ajax 异步处理Json数据
- 详谈 Jquery Ajax 异步处理Json数据.
- 详谈 Jquery Ajax 异步处理Json数据.
- jQuery Ajax异步处理Json数据详解
- ajax异步请求通过json取得响应数据
- 使用原生ajax异步返回json数据
- 使用Ajax异步加载请求JSON数据
- 在struts2+jquery使用AJAX异步提交数据,处理返回的json数据
- ros与V-rep联合使用血泪教训(ROS学习笔记四)
- LLVM & Clang
- org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read
- 2自定义View系列课程学习笔记——之Scroller和ViewDragHelper
- 其他没有转载的内容.各种小知识点
- JS使用ajax异步处理json响应数据
- js中的this指代全局对象
- python中for循环的用法
- CentOS 7:关闭firewall安装iptables并配置
- 算法设计与应用基础系列19
- 关于android 根据系统语言更改 app名字和其他配置
- Java 数组转换为list和set
- Oracle数据库学习路线图
- C++--STL---set容器