I have the following js code:
$.get('/desk/AddTicketToCart', { clientId: clientId}, function(data) {
});
And controller’s action:
public ActionResult AddTicketToCart(int clientId)
{
// do work
return new RedirectResult("/", true);
}
But, I get white page and url not changed in address bar. I also tryed the following:
return RedirectToAction("Index", "Home")
but, I also get white page.
How to make redirect properly?
Thanks.
Redirect in server won’t help you here since you’re making a ajax call. You need to set the new url in js in the callback.