Sunday, May 1, 2011

Is it possible to use muliple AJAX libraries on one page?

Hi, I am just curious. There are many ready-to-use AJAX libraries out there like Mootools, Scriptaculuos, Prototype, YUI etc

My question is, is it possible to combine them? If I download all the code and put them on the same page, will it cause errors?

Which open source AJAX library would you recommend for a beginner?

From stackoverflow
  • Of course, but like anytime you combine frameworks, you'll find you sometimes have to write your own glue code. For a beginner, it may be simpler to use just one.

  • It depends on the choice of frameworks you use. If they try to define the same variables then one is going to overwrite parts of the other. jQuery avoids this by defining the aliasing the core function so it has two names and YUI avoids it by not having a blasted dollar function in the first place.

    Libraries tend to be relatively large, so you should probably avoid using multiple ones on grounds of bloat rather then anything else.

    It is rare that using two different libraries is useful - the main reason for it is wanting to use multiple third party modules that depend on different libraries. In that circumstance, I would try to find alternatives that use the chosen library.

    What opensource ajax code you using?

    YUI usually. It is robust, well tested, well documented and powerful - although the initial part of learning curve is a little steeper then some of the others.

    It does it a disservice to call it "ajax code" though - Ajax is a very small part of any of these libraries.

    What would you recommend to ajax beginner?

    YUI.

    What ajax features that can impress people?

    That depends on who the people are. A lot of people will be impressed by being able to quickly produce slidey, fading, spinning animation effects ... but they aren't all that useful. A good event handling system doesn't do anything that will impress a lay person, but it will make like a lot easier for the programmer.

  • I recommend you to use the jQuery framework, because in my opinion has one of the best and easiest to understand implementation of AJAX.

    An example:

    
        jQuery.post('thescript.php', parametersInJson, function(response){
            alert('The server response: '+response);
        });
    
    
  • If you're using Java on the back end, the ZK framework claims to provide full AJAX capabilities, i.e. no need to mix and match a bunch of different libraries. From the testing I've done so far, they seem to be right.

  • yes you can but you might run into some trouble (you might need to override the $ function...)

    and i do recommend jQuery

0 comments:

Post a Comment