Ajax links API module help you to load any content to a specified DIV or ajaxify whole drupal site, using JQuery Ajax. This module will also load JS for Ajax-loaded content by using Drupal.attachBehaviors(). In case you dont want to load js or css, you can alter tpl for path/node type.

Links will work as normal if Javacript is disabled so no effect on web crawlers used by search engines.In HTML5 browsers, title bar and url will change using history.pushState(). Also, it will update active class on links.

Please note that this module wont ajaxify forms! To ajaxify forms ,you may use asaf module.

How to use Ajax links API :

Example : Goto module config > jQuery selector : For example, you can ajaxify all links under #content by specifying #content a.In case you want to exclude a link with class .menu, you can use !.menu a.Target DIV will be default target div defined. You can change the target DIV from module config page.

Example : echo l_ajax("add page", "node/add/page", "#content") // You can override default target DIV by passing third variable.If not, it will use default target DIV defined in module config page.

Example : Add class="ajax-link" to any link. <a class="ajax-link" href="node/add/page" rel="#content">Add page</a>
You can override default target DIV by specifying rel="".

Override tpl :

  • Developer can add/remove any variables by copying html--ajax.tpl.php and page--ajax.tpl.php to their theme. All variables available to html.tpl.php/page.tpl.php can be used.
  • In case you want to override page--ajax.tpl.php, for eg: for path /node/add, you can create page--user--add--ajax.tpl.php. Same applicable for html--node--add--ajax.tpl
  • Please read README.txt first ,for Drupal 6 only

For more detailed instruction read doc

Known Issues

Please help me fix them if you can.


Thanks to

Sun for basic idea and codes. fotisp, cityreader, Rob C, roshkovanv, agoradesign, rballou, olofjohansson and others for helping to resolve issues :)


Check some sites which using ajax_links_api module. Add yours :)

Project Information