Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Yesterday, I read couple of chapters on ASP.NET Ajax and jQuery from my ASP.NET

ID: 648823 • Letter: Y

Question

Yesterday, I read couple of chapters on ASP.NET Ajax and jQuery from my ASP.NET 4 book and I found those frameworks pretty interesting and decide to learn more about them.

Today, I borrowed some books from library on Ajax and JavaScript. It seems ASP.NET Ajax is different from Ajax and jQuery seems like the "new" JavaScript.

Does it mean that I can skip JavaScript and learn jQuery directly?

On the other hand, the non-ASP.NET Ajax book I borrowed seems to apply to the client side web programming only and looks quite different from what I learned from ASP.NET Ajax. If I'm an ASP.NET developer, I guess I should stick with ASP.NET Ajax instead of client side Ajax right? What about PHP? Is there a "PHP Ajax" similar to ASP.NET Ajax?

It's not that I'm lazy to learn other tools, but I just want to focus on the right ones.

Explanation / Answer

This is a complicated subject but here's my attempt to distill what all of these things are and how they relate.

AJAX: This is a concept that involves pulling data asynchronously into a web application without reloading the entire page. It allows for dynamic UIs such as Google Mail that act like desktop applications but run in a browser.

ASP.NET AJAX: This is a library authored by Microsoft that attempts to make the AJAX concept accessible to developers that have an ASP.NET background. It provides methods that are similar to .NET Framework methods such as String.Format and others. It has some overlap with JQuery but they can both be used in harmony together as they have different strengths and weaknesses. It is important to remember that this is a client-side library and doesn't actually have a dependency on ASP.NET. You could use ASP.NET AJAX with any server-side technology.

jQuery: This is a JavaScript library that provides a framework to make AJAX applications easy to write. It provides a powerful selection model using a CSS-like syntax for interacting with the browser DOM. It also abstracts away many of the differences between the different browsers and versions. So you are almost always better off coding against jQuery as opposed to browser-specific DOM or AJAX APIs. There is a rich ecology of jQuery plugins available which can add all sorts of powerful behavior to your web applications, without a lot of work on your part.

JavaScript: This is an interpreted language implemented by all major browsers that allows for dynamic, client-side behavior on web sites. The language itself is pretty solid, but the different APIs that the different browsers provide make it complicated to write "raw" JavaScript effectively. That is why there are all these libraries on top of it.

Now, as to the question of what you should learn as an ASP.NET developer. I would recommend getting familiar with the functionality of both ASP.NET AJAX and jQuery. Microsoft endorses both, and both are included with VS 2010. They have different strengths and weaknesses and if you understand what those are you will be more effective with using them.

You don't have to use AJAX to do ASP.NET websites, but your websites will be more powerful and more user-friendly if you do. And if you develop a sense for when AJAX is effective and when it isn't, you will be a better web developer.

Oh, and stay away from UpdatePanels. That was MS's first answer to AJAX, but they are generally bad and go against a lot of the concepts that make AJAX good. They give you a short term benefit but in the long term they are a maintainability nightmare in my experience.