I have a link in one of my views that users can click, which calls ActionResult. The link looks like this:
<a class="do_something" href="#">lorem ipsum</a>
Then I have javascript that is sent to ActionResult (no data passed to ActionResult) as follows:
$("a.do_something").click(function() {
var urltopost = "/foo";
$.post(urltopost);
return false;
});
ActionResult is designed to then do something:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult foo()
{
TempData["Success"] = "You have successfully done something";
return RedirectToAction("Index", "Home");
}
What I would like is that when the user clicks on the link, ActionResult does its job and then redirects the user to another view, displaying a TempData message, letting them know that everything is working correctly.
Everything is working fine, except for the redirect part. When a link is clicked, ActionResult is called and does what it should do, but the view is not redirected.
, , - ActionResult? jQuery ( , )?