简体   繁体   中英

jQuery vs ASP.NET Ajax

What are the differences between jQuery and ASP.NET Ajax?

They are very separate things, jQuery is a JavaScript framework that has the ability to do some rudimentary Ajax functionality while ASP.NET Ajax is a more fully-featured Ajax framework that encompasses .NET controls and server-side aspects as well as client-side aspects.

jQuery's main focus is on a creating standard, stable, and powerful framework for working with JavaScript as a whole in the client.

Albeit ASP.NET AJAX encompasses a client side framework it is perhaps best known/feared/loathed for its server side controls, particularly the UpdatePanel. What you get with ASP.NET AJAX is out-of-the-box AJAX for the most basic stuff without having to write a single line of JavaScript.

If on the other hand you need to write some JavaScript or go a little out-of-the-box, working with ASP.NET AJAX can soon become a little tedious.

jQuery on the otherhand is lightweight and requires you to write JavaScript, although for most part, the jQuery guys has done a very good job of hiding the ugly JavaScript stuff away, so apart from a small learning curve it comes pretty natural (particularly if you are on home-stretch in CSS selectors).

Main problem in using jQuery with ASP.NET can be if you mess too much with the DOM you might get ViewState/Event validation problems.

jQuery is a standalone javascript library that can be integrated into any development environment. It it widely used and many great plugins exist for it.

It can be used for much much more than just AJAX functionality. Like traversing through current elements and changing their functionality.

ASP.NET AJAX is something else entirely, since it only focuses on AJAX like functionality in the .NET environment.

Main goal of ASP.NET Ajax is calling ASP.NET web services from client using simple JavaScript notation. It also provides client access to some ASP.NET server features. Like profile, for example. All other operations it's better to perform with jQuery.

i used Ajax Control Toolkit from microsoft quite extensively for 2 years before i switched to jQuery and in my experience i think jquery ajax calls are much more light weight, efficient compared to the ajax control toolkit libraries. besides that the efficiency ofcourse depends on the data that you send & receive via your ajax calls.

you can add custom HTTP Status codes in jQuery ajax calls as well to capture any errors on the server and returning the appropriate response.

@Andrew and @Ólafur hit the nail on the head, but I would add that the biggest concept that separates these two approaches to ajax development is that w/ jQuery you get total control of what happens between the client and the server. With the MS AJAX Toolkit you give up any control over what is sent between these 2 points. If you want to be "close to the metal" you would be best to choose jQuery. If you are just working up some quick and dirty solution that needs zero customization and speedy delivery is all your client cares about, maybe take a look at the MS AJAX Toolkit.

by the way - scott gu officially announced that asp.net would include support for jquery (full intellisense too) with their ajax framework (which is really bloated)

check this link - http://weblogs.asp.net/scottgu/archive/2008/09/28/jquery-and-microsoft.aspx

if you have used ms ajax, you would be aware its really really bloated up, and many things which ms ajax does - you can achieve via jquery writing few lines of javascript code, and you would save a lot on bandwidth and performance

you can even call asp.net json + xml web services via jquery writing just few lines of code

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM