I currently make use of JQuery UI dialogs across my site. However, I've recently started to make use of the MVC TempData collection for notifications of success/failure of various actions triggered by my dialogs. Nothing particularly fancy or new. However, it's brought up an issue that I can't find a simple, obviously solution to.
On some of my dialogs, we redirect to a new page on successful submission of the data. This data is being submitted using jQuery.Post, and then we do the redirect on successful submission using window.location on the page. However, this means that any TempData we set in the controller method isn't available. Makes sense, as it seems to require the ActionResult return type to handle this.
So, my question was, using JQuery UI Dialogs, what would people suggest as a way to submitting data to the controller WITHOUT using jQuery POST or AJAX calls. Obviously I can embed a form within the dialog myself and use that, but it seems to half-defeat the point of using JQuery UI Dialog when it handles all the buttons, etc, for you.
Perhaps I'm missing something really obvious, but any help would be greatly appreciated. Many thanks.
Updated: Here is the entire Action method. NB - this is one implementation, I've actually tried this several ways. But this is the current implementation. Once the Action is called, and we do a client side redirect, the TempData I've set comes out as NULL
[Authorize]
[AcceptVerbs(HttpVerbs.Post)]
public void RetireSelf(int playerKey)
{
PlayerDTO player = _playerTask.GetPlayer(playerKey);
_log.Info("Player retiring themselves from ladder " + player.Name + player.PlayerKey);
UserDTO user = _userTask.GetUser(CurrentUserName);
if (user.UserKey != player.UserKey)
{
throw new LadderSecurityException(CurrentUserName + "trying to self retire another player");
}
_playerTask.RetirePlayer(playerKey);
TempData["notification"] = "You were retired from the ladder.";
}