Which one is better to use in ASP.NET MVC?
![]() ![]() ![]() |
Personally I prefer jQuery for the following reasons:-
In terms of what MS AJAX offers you in MVC, it can do a lot for you in terms of giving you a quick way to "AJAXify" forms and links, but as far as I'm concerned adding 90kb worth of javascript to do that isn't really worth it when the equivalent calls in jQuery (e.g $.get, $.post, $(element).load) are relatively easy to use. |
||
![]() ![]() |
Instead of making a recommendation I suggest you read Dave Ward's blog Encosia that has a series of posts on MS Ajax/ Update Panel vs. jQuery post mechanism. Dave maintains that the performance of jQuery is vastly superior as it cuts out approximately 100K from the transmission to and from the server. |
||||||
|
![]() ![]() |
Personally, despite the HtmlHelper support for ASP.NET Ajax, I find jQuery ajax in conjunction with the JQuery forms plugin to be the nicest way to do ajax form posts in ASP.NET MVC. e.g. with a jquery call on an html product list page with a form for each product allowing the item to be added to a basket, a single line of jquery code can 'ajaxify' all the forms on the page
combined with a simple 'IsAjaxRequest' property on a controller base class that checks the headers:
and some logic in the Controller to return the correct response type:
you have a form that works even with javascript turned off and no ASP.NET Ajax involved. |
||
![]() ![]() |
First of all, it could be useful to take in mind that ASP.NET MVC doesn't support, or better, doesn't has the postback concept..
It's still possible to use asp.net server controls in asp.net mvc, asp.net ajax it's one of them, but asp.net mvc it's made, it was thought, to separate concerns (views) and to be REST styled as close as possible, so taking this in mind the final thought would be:
Sorry for my english |
||
![]() ![]() |
Use ASP.NET AJAX with Web Forms and jQuery with ASP.NET MVC |
||
![]() ![]() |
I would like to mention that Microsoft supports JQuery, and they will make support for it in upcoming versions of Visual Studio. For more information please visit http://live.visitmix.com/. ASP.NET AJAX and jQuery does not overlap much, so you would like to use both. |
||
![]() ![]() |
JQuery is purely client side library. Asp.Net Ajax includes both client side and server side functionalities. IMHO, comparison ain't really fair. They might complement each other going by Microsoft's plans. |
||
![]() ![]() |
There is a variant of ASP.NET AJAX for MVC -- used with the AjaxHelper and extensions. This works well in concert with jQuery. I have instances where I use both on the same page; using MVC AJAX to update a DIV based clicking a button and using jQuery to get JSON data for a different operation on the same page. Standard ASP.NET AJAX (UpdatePanels, etc.) should be used in the WebForms world, not in MVC. |
||