MVC 2 - pass a querystring

I need to pass a querystring back on response - so that via means of jQuery I can do something with it.

something like this:
return RedirectToAction(“LogOn”, “Account”, new { id = “?action=update” });

URL needs to end up like: http://localhost:1568/Account/LogOn/?action=update

but the above code produces this instead: http://localhost:1568/Account/LogOn/%3Faction%3Dupdate

I don’t want the encoding…


The keyword of action actually has nothing to do with the issue, jQuery automatically escapes the results, so you need to either use unescape() or decodeURIComponent().

var url = unescape(jqueryResult);
var url = decodeURIComponent(jqueryResult);

Although, I do agree, using action is a bad idea, as older browsers will become confused and it may not pass W3C specifications, but at the same time, I really don’t care about older browers that struggle with that anymore.


If you’re wanting to pass something back to jQuery why not use a JsonResult, more lite-weight and designed for just that purpose. :slight_smile:

got it, use: return RedirectToAction(“LogOn”, “Account”, new { mode = “update” });

don’t use the keyword action :slight_smile: