标签:text enter user char center context control ica request
function postJson(){ var json = {"username" : "imp", "password" : "123456"}; $.ajax({ type : "post", url : "<%=basePath %>ajaxRequest", contentType : "application/json;charset=utf-8", dataType : "json", data: JSON.stringify(json), success : function(data){ alert("username:"+data.username+" id:"+data.id); }, error : function(){ alert("请求失败"); } }) }
注意:
<% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %>
@ResponseBody @RequestMapping(value="/ajaxRequest",method=RequestMethod.POST) public User ajaxRequest(@RequestBody User user){ System.out.println(user); return user; }
注意:
标签:text enter user char center context control ica request
原文地址:http://www.cnblogs.com/javafucker/p/7509099.html