`@ResponseBody
@RequestMapping(value="/delete.do")
public String delete(int projectNo) {
int result=service.delete(projectNo);
return "admin/manage";
}`
`$.ajax({
url : "/delete.do",
data:{projectNo:projectNo},
success : function(result){
window.location.href = result.redirect;
},
error : function(){
alert("error");
}
});`
in this ajax, i got "admin/manage" as result.
this ajax is written in admin/manage.
i want to do redirect to admin/manage after ajax but i don't know how to do
CodePudding user response:
Your code should work correctly, if not, try to append /
before result.redirect
to redirect same domain
$.ajax({
url: "/delete.do",
data: { projectNo: projectNo },
success: function (result) {
window.location.href = "/" result.redirect;
},
error: function () {
alert("error");
}
});