function addDiv() {
$.ajax({
url : "/showVideoDiv",
traditional : true,
type : "post",
dataType : "json",
data : {
"id" : "ids"
},
success : function(data) {
if(data.state=="1"){
alert("成功");
}
}
以上为前台jsp的function方法
以下为后台controller方法
@RequestMapping(value="/showVideoDiv",method = RequestMethod.POST)
@ResponseBody
public Map<String,String> showVideoDiv(String id){
System.out.println(id);//输出字符串:ids
Map<String,String> map = new HashMap<String,String>();
map.put("state", "1");//传回前台的数据
return map;
}