This Question have 3 answers right now.

ASP.Net MVC, AJAX, and progressive enhancement

By : DAC
Source: Stackoverflow.com
Question!

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.

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.

By : DAC


Answers

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. The Ajax form can be made visible by javascript, along with hiding the standard form.

By : Matthew


Typically you would create your site so that it works without JavaScript being enabled. Then you would add the unobtrusive JavaScript 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.

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.

By : Ian Oxley


No, we are no distributing forms or anything with the app... it's an exe. I forgot to mention that the EXE is compressed and obfuscated with KONXIZE 1.0.

By : nmarmol



Web App to best Add, Delete and Edit rows without refreshing the page

Paged table with ASP.NET MVC and AJAX

Is there a Request.IsMvcAjaxRequest() equivalent for jQuery?

ASP.Net MVC Ajax form with jQuery validation

Json or Html? How to tell? [duplicate]

Setting ajax url for jQuery in JS file using ASP.NET MVC

Loading HTML controls from JSON in jQuery (that is, reverse of Ajax serialiseArray)

How do you trigger the “error” callback in a jQuery AJAX call using ASP.NET MVC?

ASP.NET MVC and JQuery get info to controller

What is the right pattern for using JQuery Ajax and ASP.Net Mvc?

Security and Cross Domain with ASP.NET MVC JsonResult and jQuery

What is the best way to implement an AJAX main menu?

ASP.NET MVC scenario, similar to 'Post your answer' on StackOverflow

Does PartialView do what I think it should (but doesn't)?

.getJSON produce a Download of a File ASP.NET MVC

Can't Submit Form With Simple Validation with the JQuery Form Plugin

Show process status using AJAX and ASP.NET MVC

jQuery / ASP MVC — parsererror in “$.ajax” calls

Video about ASP.Net MVC, AJAX, and progressive enhancement