Drupal 5: Drupal, AJAX, and jQuery made simple
Here’s a simple, minimal implementation of AJAX in Drupal using jQuery.
First create a menu item callback.
Next create the callback function. To test the menu item and callback function, go to http://[YOURSITE]/ajax; you should get the text “wee!” without any theming.
Next create a page that has a button on it with an ID of “ajaxButton”. The following jQuery will add an onClick event to the button.
The jQuery binds a function to the onClick event, with makes the Ajax call to the URL, which simply returns the text “wee!”, which is then echoed in a javascript alert box.