Book Image

Learning Drupal 6 Module Development

Book Image

Learning Drupal 6 Module Development

Overview of this book

Table of Contents (14 chapters)
Learning Drupal 6 Module Development
Credits
About the Author
About the Reviewers
Preface

Chapter 5. Using JavaScript and AJAX/JSON in Modules

The module we created in the last chapter used the theme system to provide user‑interface elements for our Philosophy Quotes module. In this chapter, we will pick up where we left off, and we will take steps toward a richer user interface.

In this chapter, we will use Drupal's JavaScript libraries (including the popular jQuery library) to add client-side features to the Philosophy Quotes module. We will also use AJAX (Aysnchronous JavaScript and XML) technology to dynamically change page contents without having to do a full page reload.

Here are some of the items we will cover while working on this module:

  • Using the Drupal and jQuery JavaScript libraries

  • Adding new locations (URLs) using hook_menu()

  • Building a JSON (JavaScript Over the Network) service

  • Fetching content using AJAX/JSON queries

Picking up Where We Left Off

In the last chapter, we built a module that read data from a custom content type, and displayed it as block content. This module...