title: ASP MVC Ajax Controller pattern?
body: <p>My MVC app tends to have a lot of ajax calls (via JQuery.get()). <b>It's sort of bugging me that my controller is littered with many tiny methods that get called via ajax</b>. It seems to me to be sort of <b>breaking the MVC pattern</b> a bit--the controller is now being more of a data access component then a URI router.</p>
  
  <p>I refactored so that I have my 'true' controller for a page just performing standard routing responses (returing ActionResponse objects). So a call to /home/ will obviously kick up the HomeController class that will respond in the canonical controller fashion by returning a plain-jane View.</p>
  
  <p>I then moved my ajax stuff into a new controller class whose name I'm prefacing with 'Ajax'. So, for example, my page might have three different sections of functionality (say shopping cart or user account). I have an ajax controller for each of these (AjaxCartController, AjaxAccountController). <b>There is really nothing different about moving the ajax call stuff into its own controller class--it's just to keep things cleaner</b>. on client side obviously the JQuery would then use this new controller thusly:</p>
  
  <pre><code>//jquery pseudocode call to specific controller that just handles ajax calls
  $.get('AjaxAccount/Details'....
  </code></pre>
  
  <p>(1) is there a better pattern in MVC for responding to ajax calls?</p>
  
  <p>(2) It seems to me that the MVC model is a bit leaky when it comes to ajax--it's not really 'controlling' stuff. It just happens to be the best and least painful way of handling ajax calls (or am I ignorant)?</p>
  
  <p>In other words, <b>the 'Controller' abstraction doesn't seem to play nice with Ajax</b> (at least from a patterns perspective). Is there something I'm missing?</p>