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');// Return the currently selected row
}
})
servlet code
String[] ids = request.getParameterValues("id");//Get the passed array
JSONArray jsonData = new JSONArray();//json data
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);//return data out.flush();
out.close();
//You can also get it like this
//Shopping cart click to pay
@RequestMapping("/Cart_Pay.action")
public String Cart_Pay(HttpServletRequest request, HttpServletResponse respone) {
String json_data2 = request.getParameter("json_data");//Get the passed array
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 data
return "/Cart.jsp";
}
In the development process, because the business needs to do batch tasks, the id is often encapsulated into an array and passed to the background for batch processing. The ordinary ajax parameter tran...
Solve ajax unable to receive array objects Problem Description: The front end sends the ajax array object; such as:{“tids”:["1","2","3"]}, The current station...
About AJAX appears to receive no background pass worth In a recent project to determine whether to add successful data, use ajax to submit the value from the form, found that the background return val...
How to pass an array in java url, how does the springMVC framework contr...
Passing data in ajax can be used Background reception can be used: Note: The key is the $.ajax({traditional: true,}) setting, not the next String[] checkedIds can't receive the value. &n...
Ajax pass array: Ajax pass object: ...
Examples ...
Backstage $.ajax({ url: “/bill/distribute”, type: “post”, data: {“ids”: 1,2,3,4,5,}, dataType: “json”, success: function (data) { Global.success(success...
If you want to use ajax to pass the array to the background,traditional must be set to true。...
similar parameters...