Is it recommended to use unobtrusive AJAX with MVC 5?

Zilberman Rafael picture Zilberman Rafael · Jan 4, 2014 · Viewed 10.9k times · Source

I know that there is library that supports unobtrusive AJAX so I asked my father (also .net programmer) why he don't use it and his answer was very surprising for me:

"The unobtrusive AJAX (in your case jquery.unobtrusive-ajax) not recommended for use so I don't using it. I prefer manually write AJAX requests using JQuery."

I searched around the internet but I can't find place that saying that unobtrusive AJAX is not recommended for use.

So is there any problem with the usage of jquery.unobtrusive-ajax and MVC AJAX helpers? If so, Can you say what is the problem and is it fixable?

Answer

Eilon picture Eilon · Jan 26, 2014

The Unobtrusive Validation and AJAX support in ASP.NET MVC follow many best practices that enable Progressive Enhancement and are also super easy to use. The unobtrusive AJAX library (not the unobtrusive validation library) is admittedly a bit limited in functionality, but if it satisfies the requirements of the application you are writing, then by all means use it. And because the source code of it is in your app (it's JavaScript, after all), it's generally straightforward to make any updates or changes to it as you see fit.

If someone wants to write everything manually, they are welcome to write assembly code to solve all their problems. Or just etch 1's and 0's onto a DVD with a laser pointer.