What are the best strategies for using multiple AJAX libraries?


What experience can you share about using multiple AJAX libraries?

There are useful features in Prototype, some in jQuery, the Yahoo library, etc. Is it possible to include all libraries and use what you want from each, do they generally all play nicely together with name spaces, etc. For the sake of speed is there a practical limit to the size/number of libraries to include or is this negligible? Are there pairs that work particularly well together (e.g. Prototype/Scriptaculous) or pairs that don't?


The best strategy is to not use multiple libraries. It's tempting to want to throw more libraries at a problem, but it's inefficient, error prone, and makes your code harder to maintain by others.

In most cases you should be able to avoid using multiple libraries by understanding your problem domain and which library will help you best solve it. There is also a myriad of plugins and extensions for all of these libraries.

For example, JQuery supports cross-domain JSONP calls right out of the box and has a nice widget library in JQueryUI, Prototype does not.

$.getJSON('http://anothersite.com/mashup.json?callback=?', function(data) { });

Prototype has really good OO support and it's easy to traverse the DOM, but lacks some of the cross-domain functionality required to create widgets and mashups.

var Foo =  Class.create({  
  initialize: function(name) {
    this.name = name;

var Bar = Class.create(Foo, {
  initialize: function($super, name)  {

Mootools has great effects, good OO support, really solid widgets and cross domain request, but (and this might just be my impression), the development community isn't as collaborative and social with the global community (outside of mootools) as the other communities (Prototype used to be this way). This could be a result of their main developer(s) living outside the US, and thus are not able to attend as many conferences and participate in the greater community. I wouldn't let that deter you completely though, but it is something to keep in mind.

By : Caged

You could use Google AJAX Libraries API. It provides a common distribution network and a loading architecture for jQuery, prototype, script.aculo.us, MooTools and dojo

You could use all those libraries, but I highly recommend against it. Downloading and executing that much JavaScript will most likely choke the browser and slow down your user's experience. It would be much better from a user's perspective and a developer's to pick one. Less context/architecture switching and less code to maintain.

Like other answers have said, most don't conflict.

See Yahoo!'s Exceptional Performance site for more info.

This video can help you solving your question :)
By: admin