ajax
$.ajax({
url : 'Admin_User_management?3',
type: 'post',
data : {id:ids},
traditional: true,
success : function(data) {
//console.info(ids.join(','));
//console.log(data)
//datagrid.datagrid('load',data);
//datagrid.datagrid('reload');// 返回当前选中的行
}
})
servlet代码
String[] ids = request.getParameterValues("id");//获取传递来的数组
JSONArray jsonData = new JSONArray();//json数据
db_admin.Admin_Del_user(ids);
PrintWriter out = response.getWriter(); Map<String, Object> map = new
HashMap<String, Object>(); map.put("msg", "success");
jsonData.fluentAdd(map); out.println(jsonData);//返回数据 out.flush();
out.close();
//也可以这样获取
//购物车点击付款
@RequestMapping("/Cart_Pay.action")
public String Cart_Pay(HttpServletRequest request, HttpServletResponse respone) {
String json_data2 = request.getParameter("json_data");//获取传递来的数组
List<HashMap> map = JSONArray.parseArray(json_data2, HashMap.class);
for(HashMap<String,Object> map1:map) {
String id = map1.get("id").toString();
String total = map1.get("total").toString();
System.out.println(id);
System.out.println(total);
}
//JSONArray jsonData = new JSONArray();//json数据
return "/Cart.jsp";
}