ajax+springboot传递多层Map
猪:
data为json格式的数据对象(字符串,可用JSON.stringify转换)
contentType为"appliaction/json"(表示数据为json格式)
$("#topo_configer_close").click(function(){ var url = "setConfiger"; $.ajax({ type : "post", url : url, contentType : "application/json", data : configer, dataType : "json", success : function(data){ if(data){ $("#configer_div").css("display","none"); } } }); });
@ResponseBody @RequestMapping(value="setConfiger", method=RequestMethod.POST) public boolean setConfiger(@RequestBody Map<String, Map<String, ConfigerValue>> configerMap) { return configerService.setConfiger(configerMap); }
{"1":{"名称":"Yes","cpu":"Yes","内存":"Yes","硬盘":"Yes","是否升级":"No","是否备份":"No","备注":"No"},"2":{"是":"Yes","否":"No"},"3":{"是":"Yes","否":"No"},"4":{"是":"Yes","否":"No"}}