您无法进入对POST请求的响应中返回的页面。但是您可以为ajax 增加 成功 :
$.ajax({type: 'POST',dataType: 'json',url: "ajaxEditFormUpdate",data: JSON.stringify(newData),beforeSend: function(xhr) { xhr.setRequestHeader("Accept", "application/json"); xhr.setRequestHeader("Content-Type", "application/json"); },success: function (response) { window.location.href = '/content/review';}});您的控制器现在将如下所示:
@RequestMapping(value = "ajaxEditFormUpdate", method = RequestMethod.POST)@ResponseBody public ResponseEntity<Void> handleResponse(@RequestBody String records) { System.out.println(records); return new ResponseEntity<>(HttpStatus.OK); }但是现在您还需要使用GET来创建新控制器以返回
/content/review页面视图
ps 如果您仍想在不更改任何控制器的情况下呈现页面,则另一个变种似乎是一种破解,您的成功必须是这样的:
success: function (response) { document.open(); document.write(response); document.close(); }但是不建议使用此方法。



