Created
June 9, 2010 17:49
-
-
Save jarsen/431854 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// JQUERY AJAX FUNCTIONALITY | |
// Added by Jason Larsen | |
// 06 May 2010 | |
// adds .ajax and .ajax_node classes | |
// .ajax will load any page via ajax | |
// .ajax_node will load the drupal node at the specified href (loads only content) | |
// | |
// to implement, simply give the desired element the class of either ajax, or ajax_node, | |
// and include a href tag with the desired URL | |
// | |
// EX: <a class="ajax_node" href="/technology">AJAX Action!</a></p> | |
$(document).ready(function() { | |
// AJAX functionality for drupal nodes | |
$(".ajax_node").click(function() { | |
var ajax_src = $(this).attr("href"); // we're gonna load the href | |
// empty target div and load in content | |
// the space in the string before the #id is necessary | |
$("#ajax_area").empty().load(ajax_src + " #ajax_wrapper"); | |
return false; // stops the link from following through | |
}); | |
// General AJAX fucntionality | |
$(".ajax").click(function() { | |
var ajax_src = $(this).attr("href"); | |
$("#ajax_area").empty().load(ajax_src); | |
return false; | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment