jQuery的Ajax接收java返回数据方法
来源:
中文源码网 浏览:359 次 日期:2024-04-26 10:30:09
【下载文档: jQuery的Ajax接收java返回数据方法.txt 】
jQuery的Ajax接收java返回数据方法
1.前端Ajax请求如下:
$.ajax({
type : "post",
//async:false,
url : PATH + "/product/selectPicture.action",
dataType : "json",
success : function(data) {
$.each(data,function(k,v){
alert(k +":"+ v);
});
}
});
2 其中PATH在jsp页面中定义:
<%
String path=request.getContextPath();
%>
2.1 后端java代码输出json格式数据:
List