jQuery Address


Deep linking for the masses

A very excellent plug-in for deep-linking or backlinks used for AJAX is jQuery.address().

$.address use the jQuery 'change' event to give information when the addressbar was changed.

$.address():

In the most AJAX applications you use a specified parameter to call the AJAX function, like the requested HTML page. Use this string and append it to the URL with location.hash, for using later in your AJAX application.


function ajaxcall(){
    location.hash="parameter";
} 

Now your application is ready to change the addressbar with next and back buttons on the browser or with mouse buttons 4 and 5.
Every time, after the function ajaxcall() was called and the URL has changed the $.address.change(function(event){...}) callback is called.
The event-parameter is the parameter from the URL. Use it to call and generate the new, next or old HTML content with your AJAX function, like $.load(), as you do this as usual with your AJAX function.


$.address.change(function(event){
    $('#content').load(event.value + '.xml');
} 

The Javascript framework is available at: http://www.asual.com/jquery/address/


© Kometschuh.de | Impressum | GitHub | Facebook |