0
我有以下的功能,使一个请求:ModelAndView的不重定向,但给正确的响应
function postIngredient(action, options) {
var xhr = new XMLHttpRequest();
xhr.open(options.method, action, true);
xhr.setRequestHeader('Content-Type', 'application/json; charset=UTF-8');
xhr.setRequestHeader(options.security.header, options.security.token);
// send the collected data as JSON
xhr.send(JSON.stringify(options.params));
xhr.onloadend = function() {
// done
};
}
功能触发服务器上的方法,该方法基本上返回一个ModelAndView对象:
...
ModelAndView mav = new ModelAndView("redirect:/recipies/edit?id=1");
....
return mav;
因此,在“预览”ta b的请求我有正确的页面,它应该重定向,但浏览器中没有重定向。该页面保持与postIngredient()函数初始调用的位置相同。那么如何重定向呢?
工程就像一个魅力。感谢您的解释和解决方案。 – Cristian
不客气! –