Ajax Framework: Difference between revisions

From Citizendium
Jump to navigation Jump to search
imported>Michael Bonanno
imported>Michael Bonanno
Line 92: Line 92:


=====Sliding=====
=====Sliding=====
slideDown( speed, callback ) Returns: jQuery
*slideDown( speed, callback ) - Reveal all matched elements by adjusting their height and firing an optional callback after completion.
Reveal all matched elements by adjusting their height and firing an optional callback after completion.
*slideUp( speed, callback ) - Hide all matched elements by adjusting their height and firing an optional callback after completion.
slideUp( speed, callback ) Returns: jQuery
*slideToggle( speed, callback ) Toggle the visibility of all matched elements by adjusting their height and firing an optional callback after completion
Hide all matched elements by adjusting their height and firing an optional callback after completion.
 
slideToggle( speed, callback ) Returns: jQuery
Toggle the visibility of all matched elements by adjusting their height and firing an optional callback after completion
=====Fading=====
=====Fading=====
fadeIn( speed, callback ) Returns: jQuery
fadeIn( speed, callback ) Returns: jQuery

Revision as of 22:31, 10 August 2008

AJAX framework is a cross-browser framework that allows developers to develop dynamic web pages(that use AJAX) quickly.
Web pages developed using an AJAX framework can call web services and server pages through JavaScript without having to submit the current page. Recent Web-applications tend to use these for providing more interactivity and improving their overall functionality.

While there are hundreds of Ajax frameworks available, there currently only about 20 heavily used or heavily written about frameworks that fall into 3 categories. While all simplify the creation of Javascript-based dynamic based web applications, most are object-oriented packages that are written in Javascript itself. However, several others are written in the server side scripting language PHP, others are written in Java, and a few exist for ASP.net and ColdFusion.

Categories of AJAX frameworks

(X)HTML/CSS Supplement Frameworks

Classic examples of this type of framework are Prototype and JQuery. As is suggested by JQueries tagline "The Write Less, Do More Javascript Library", these frameworks attempt to add tools to a designers resource kit to simplify and standarize the javascript required to perform AJAX type actions.

Toward the goal of 'simplifying' these frameworks typically provide syntax that is reasonably cross-browser and future-proof. That is as new browsers are released and new vulnerabilities are discovered in older AJAX techniques, users of these frameworks should be able to simply update their framework library files with no or little modification to their original code.

Toward the goal of standardization, the adoption of these frameworks makes it relatively simple for an new programmer to walk into an existing project and make sense of the code.

The types of methods included by these frameworks can loosely fall into 4 categories.

Pure AJAX Methods

These libraries generally include a call-back system that attempts to simplify the creation and execution of HTTPXMLRequest objects and to simply the handling of a returned XML, JSON or (X)HTML response.

Event Handling Systems

"Event Handling" methods add generally add the ability to attach new actions to DOM elements.

DOM/CSS Manipulation Methods

These frameworks will also include code to assist in CSS and DOM manipulation. The best way to explain these are probably just through examply JQuery inlcudes the following events: blur( ) Returns: jQuery Triggers the blur event of each matched element. blur( fn ) Returns: jQuery Bind a function to the blur event of each matched element. change( ) Returns: jQuery Triggers the change event of each matched element. change( fn ) Returns: jQuery Binds a function to the change event of each matched element. click( ) Returns: jQuery Triggers the click event of each matched element. click( fn ) Returns: jQuery Binds a function to the click event of each matched element. dblclick( ) Returns: jQuery Triggers the dblclick event of each matched element. dblclick( fn ) Returns: jQuery Binds a function to the dblclick event of each matched element. error( ) Returns: jQuery Triggers the error event of each matched element. error( fn ) Returns: jQuery Binds a function to the error event of each matched element. focus( ) Returns: jQuery Triggers the focus event of each matched element. focus( fn ) Returns: jQuery Binds a function to the focus event of each matched element. keydown( ) Returns: jQuery Triggers the keydown event of each matched element. keydown( fn ) Returns: jQuery Bind a function to the keydown event of each matched element. keypress( ) Returns: jQuery Triggers the keypress event of each matched element. keypress( fn ) Returns: jQuery Binds a function to the keypress event of each matched element. keyup( ) Returns: jQuery Triggers the keyup event of each matched element. keyup( fn ) Returns: jQuery Bind a function to the keyup event of each matched element. load( fn ) Returns: jQuery Binds a function to the load event of each matched element. mousedown( fn ) Returns: jQuery Binds a function to the mousedown event of each matched element. mousemove( fn ) Returns: jQuery Bind a function to the mousemove event of each matched element. mouseout( fn ) Returns: jQuery Bind a function to the mouseout event of each matched element. mouseover( fn ) Returns: jQuery Bind a function to the mouseover event of each matched element. mouseup( fn ) Returns: jQuery Bind a function to the mouseup event of each matched element. resize( fn ) Returns: jQuery Bind a function to the resize event of each matched element. scroll( fn ) Returns: jQuery Bind a function to the scroll event of each matched element. select( ) Returns: jQuery Trigger the select event of each matched element. select( fn ) Returns: jQuery Bind a function to the select event of each matched element. submit( ) Returns: jQuery Trigger the submit event of each matched element. submit( fn ) Returns: jQuery Bind a function to the submit event of each matched element. unload( fn )

Visual Effects

Once again an example of visual effects is probably most helpful. JQuery includes the following:

Basics
  • show( ) - Displays each of the set of matched elements if they are hidden.
  • show( speed, callback ) - Show all matched elements using a graceful animation and firing an optional callback after completion.
  • hide( ) - Hides each of the set of matched elements if they are shown.
  • hide( speed, callback ) - Hide all matched elements using a graceful animation and firing an optional callback after completion.
  • toggle( ) - Toggles displaying each of the set of matched elements.
Sliding
  • slideDown( speed, callback ) - Reveal all matched elements by adjusting their height and firing an optional callback after completion.
  • slideUp( speed, callback ) - Hide all matched elements by adjusting their height and firing an optional callback after completion.
  • slideToggle( speed, callback ) Toggle the visibility of all matched elements by adjusting their height and firing an optional callback after completion
Fading

fadeIn( speed, callback ) Returns: jQuery Fade in all matched elements by adjusting their opacity and firing an optional callback after completion. fadeOut( speed, callback ) Returns: jQuery Fade out all matched elements by adjusting their opacity and firing an optional callback after completion. fadeTo( speed, opacity, callback ) Returns: jQuery Fade the opacity of all matched elements to a specified opacity and firing an optional callback after completion.

Custom

animate( params, duration, easing, callback ) Returns: jQuery A function for making custom animations. animate( params, options ) Returns: jQuery A function for making custom animations. stop( ) Returns: jQuery Stops all the currently running animations on all the specified elements. queue( ) Returns: Array<Function> Returns a reference to the first element's queue (which is an array of functions). queue( callback ) Returns: jQuery Adds a new function, to be executed, onto the end of the queue of all matched elements. queue( queue ) Returns: jQuery Replaces the queue of all matched element with this new queue (the array of functions). dequeue( ) Returns: jQuery Removes a queued function from the front of the queue and executes it.


(X)HTML/CSS Replacement Frameworks

Server-End Technology Adapter Kits

Some of the most popular and interesting Ajax frameworks are:

Framework Name Platform Type What makes it interesting
ExtJS Javascript Small codebase, powerful, in use by many clients
Prototype/Script.aculo.us Javascript Completely free, high adoption among many large client, Prototype tends to handle data exchange while Script.aculo.us handle GUI effects. Allows uses of the smaller Prototype only codebase if you don't need fancy visual effect.