标签:return span model request new func alert hello query
@RequestMapping("/hello")
@ResponseBody
public Hello getJson(HttpServletRequest request,HttpServletResponse response,Model model){
Hello hello=new Hello();
hello.setStr("hello world");
return hello;
}
<span id="hello">hello</span>
//post请求
$("#hello").click(function(){
$.post("${ctx}/partner/hello",function(data){alert(data.str);},"json");
});
//ajax请求
$("#hello").click(function(){
$.ajax({
type: "POST",
url: "${ctx}/partner/hello",
dataType:"json",
success: function(data){
alert( "data: " + data.str );
}
});
});
标签:return span model request new func alert hello query
原文地址:http://www.cnblogs.com/austinspark-jessylu/p/6744926.html