双节归来,接着上一篇
fillData(data)填充
<a class="c-50a73f mlr-6" href="javascript:void(0)" onclick="del(\''+ v.id+'\')">删除</a>
调用JS :
function del(id){ if(!confirm("您确定删除此记录吗?")){ return false; } //$.get(URL,data,function(data,status,xhr),dataType) // jquery HTTP GET 请求到页面并取回结果 $.get("./delete/"+id,{ts:new Date().getTime()},function(data){ if(data==1){ alert("删除成功"); pageaction(); }else{ alert(data); } }); }
MovieController.java
@RequestMapping(value="/delete/{id}",method = RequestMethod.GET) public String delete(@PathVariable Long id) throws Exception{ Movie movie = movieRepository.findOne(id); movieRepository.delete(movie); logger.info("删除->ID="+id); return "1"; }