@RequestMapping("/refresh")
public class IndexController {
@RequestMapping
public String globalRefresh(Model model) {
Integer h=2;
model.addAttribute("uu",h);
return "test";
}
}
这是controller里传入变量
<script>
var t=[[${uu}]];//这里就取到了model变量的值
function localRefresh() {
$('#test').load("/local/"+t);
}
</script>
一共就一句话
var t=[[${后台变量名}]];