springboot项目默认访问页面index.html,通过http://localhost:8999 即可访问。现在需要通过点击按钮跳转至另外一个html页面,遇到的问题是成功访问controller中的方法,但是页面没有刷新为controller中返回的html页面
点击按钮时调用records方法
function Records(){
$.ajax({
url: "/a",
type: "post",
dataType: "string",
success: function (data) {
location.href("/a");
console.log("成功跳转");
},
err: function (e) {
alert("信息获取失败!");
}
})
}
controller方法:
@Controller
public class RecordsInfoController {
@RequestMapping(value = "/a")
public String b(){
return "Records"; //返回records页面
}
}
最后已经成功访问了a方法,返回了页面内容,但是浏览器链接地址没刷新还是http://localhost:8999/,按说访问了方法a 链接地址不是应该更新为http://localhost:8999/a 这样才对吗,不知道是什么原因,请各位帮忙解答一下,感谢!