Javascript
-
Calling .NET MVC 3 action method via jQuery ajax and handling serverside redirect
Recently I developed a .NET MVC 3 application where jQuery would be a core part of the design and it was accepted that we did not have to worry any special optimization for phone or mobile devices or disabling of javascript. During development of this application I wanted to make use of page redirects while using the inherited .NET Controller RedirectToAction() method. This worked well. When making HttpPost or HttpGet requests I would do the standard re-direct as necessary and everything worked as I would expect. However, as mentioned the majority of our requests were via jQuery ajax. And not only that, the responses to the ajax request would vary…