Drupal JSON Services Examples with PhoneGap and JQuery Mobile for Android

UPDATE: Please read this article for a much more detailed explanation on how to get PhoneGap up and running to communicate with Drupal Services.

Drupal - Post Data via Ajax to PHP Menu Callback with JQuery and JSON

Drupal 7

I found this solid example for Drupal 7.


The code for D7 is much more elegant, there are some great new features in D7 to make this stuff easier.

Drupal 6

Put this PHP code inside your module, e.g. sites/all/modules/my_module/my_module.module

Detecting Body Background Image Click with JQuery on a Drupal Zen Sub Theme

So the other day I needed to detect when someone clicks on the background image of my drupal zen sub theme. Here is how I did it using jquery:

JQuery Child Selector vs. Find

So today I thought I knew enough about JQuery to easily add a click function to some unordered list menu items in a Drupal Panel... wrong.

Since Panels adds a bunch of its own divs inside the container div, this was not working:

$('div.my_panel > ul.menu > li').click(function () { alert('click'); } );

After a little experimenting, I realized the child selector doesn't work the way I thought. It is a "child" selector I guess, not a "grand child" selector. So instead I used the JQuery 'find' function.

This worked:

Subscribe to RSS - jquery