Getting started with AJAX in Drupal 5.x

Sample code and slides now online here. Enjoy!

Ever wanted to add a little AJAX goodness to your Drupal projects but didn't know where to start? This session will introduce developers to surprisingly easy ways to integrate JavaScript, JQuery and Drupal. JQuery and Drupal are a great match and make it almost easy as pie to implement some great "next generation" features. I've recently had occasion to teach myself how to use the JQuery library with Drupal 5 and although it was a bit confusing at first, it's quite simple and very powerful once you get the hang of it. I'm by no means a JavaScript or AJAX expert, but I've got it doing everything that I needed it to. The goal of this session is to save folks the headaches and confusion of getting started with AJAX and Drupal.

The proposed topics I would cover:

* Introduction (terms, concepts)
* Integrating generic javascript into Drupal
* Tour of some of Drupal's built-in Query functionality (autocomplete, etc)
* Several ways to say "hello world!" using Drupal 5.x and JQuery
* Interface and display functionality (fade, slide, etc)
* Drupal meets AJAX - using JQuery to talk to Drupal callbacks
* Taking it further - tips, tricks and fancy footwork

All code used in the demos and all presentation slide html will be made available to all Drupal Camp attendees under GPL 2.


Broken links


The links to the sample code and the slides are broken
can someone please repost


Files are back

Sorry about that -- files are back.

Files not online anymore?

Links at return File Not Found errors. :-(

I'm learning a little just from the proposed topics though... ;-)

benjamin, Agaric Design Collective

Drupal and Ajax

For anyone interested in this topic, I just created another tutorial on how to create your own custom Ajax goodness in Drupal 5.0. The tutorial is called Drupal and Ajax : A complete Tutorial.

I hope this helps!



Ajax slides online

Along with the sample code, the slides are now online for this talk over here.



too bad this is on Friday

too bad this is on Friday and I have a day long meeting at work.

Is there going to be any slides, notes, reference material available online afterwards?

I second that

Too bad, indeed. I was looking forward to this session, but something else came up so I unfortunately can't attend DrupalCamp on Friday

All slides & code will be posted

Hi folks:

Yes, the full side set (as html), the custom drupal 5 module that contains demo code and all of its associated javascript will be posted online for any and all to fold, spindle and mutilate as you like under GPL 2.

We'll post it here once Drupalcamp is over.



For me, the last two bullet

For me, the last two bullet points are much more important than the intro to AJAX stuff. JQuery is pretty simple on its own, but I've had difficulty with telling Drupal to not return a themed page (just the bit of data that the ajax wants) and submitting forms using AJAX and the Form API.
Dan Kurtz

Re: For me, the last two bullet

Thanks for the feedback. The talk is really directed at those looking to get started rather than those looking for more advanced applications of JQuery, but to hopefully answer your questions:

To pump out a non-themed blob of html for display under an AJAX-driven interface do something like so:

function _my_ajax_menu_callback() {
$output = "I Like Pie!";
print $output;

Not sure exactly what problems you're having w/ the Forms API but if you want something other than the regular old #autocomplete stuff, just bind your javascript to the form elements in the ready() function