Strtus1 Ajax 从后台发送数据为什么前台接受的值为null
Strtus1 Ajax 从后台发送数据为什么前台接受的值为null
```
后台代码
public void queryJSON (HttpServletRequest request,HttpServletResponse response)throws Exception{
request.setCharacterEncoding("GBK");
response.setContentType("text/html;charset=GBK");
PrintWriter out=response.getWriter();
// List<SysEventDto> dptList = pageRecord.getRecordList(limit); //获取数据
HashMap map = new HashMap();
map.put("1", 1);
List list = new ArrayList();
list.add(map);
JSONArray json=JSONArray.fromObject(list);//把列表的数据装换为json格式
System.out.println(json);
JSONObject jo=new JSONObject();
jo.put("events", json);
out.print(jo);
out.close();
}
Jsp中代码
<script>
function showRole() {
$.ajax({
url : '../EventAction1.do',
type : 'post', // 数据发送方式
dataType : 'json', // 接受数据格式
error : function(json) {
alert("数据加载失败");
},
async : true,// 异步加载
success : function(result) {
console.log(result);
}
});
}
</script>
```