<p>I am looking for a reliable technique for adding Ajax to a working ASP.NET MVC application. I want to use jQuery, and understand how to use the AJAX functionality from jQuery. </p>

<p>What I need to know is how I should write my controller so that I can run the site without JavaScript, but at the same time make AJAX calls possible without the need for a separate view, separate controller, or any kind of route hack. My goal is to have a working application enhanced when JavaScript is enabled without the need to duplicate or recreate elements of the app.</p>

[{'answer_id': 56464, 'author': 'Ian Oxley', 'author_id': 1904, 'author_profile': 'https://Stackoverflow.com/users/1904', 'pm_score': 1, 'selected': False, 'text': '<p>Typically you would create your site so that it works without JavaScript being enabled. Then you would add the <a href="http://en.wikipedia.org/wiki/Unobtrusive_JavaScript" rel="nofollow noreferrer">unobtrusive JavaScript</a> needed to enhance your site with Ajax e.g. adding event handlers for links, form submits, etc. to make GET / POST requests and update your UI accordingly.</p>\n\n<p>The only changes you would need in your MVC app would be to handle the Ajax requests and return the data as JSON, XML, etc.</p>\n'}, {'answer_id': 432393, 'author': 'Matthew', 'author_id': 20162, 'author_profile': 'https://Stackoverflow.com/users/20162', 'pm_score': 0, 'selected': False, 'text': '<p>in your controller (derived from Controller), you can call Request.IsMvcAjaxRequest() to check if the request is a normal POST or an AJAX request.  This will be true if the request was created from a an AjaxForm submit or an AsyncHyperlink.\nThe Ajax form can be made visible by javascript, along with hiding the standard form.</p>\n'}]
['https://Stackoverflow.com/questions/56445', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/']