Your SlideShare is downloading. ×
0
×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Drupal 7 advanced ajax

45,931

Published on

Published in: Technology
0 Comments
15 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
45,931
On Slideshare
0
From Embeds
0
Number of Embeds
6
Actions
Shares
0
Downloads
334
Comments
0
Likes
15
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Drupal 7 Advanced AJAX Tips and Tricks
  • 2. Summary • Non-form related AJAX • Responding to an AJAX request • Bind AJAX behavior to a simple link • In more than one way • Modify this behavior via javascript • Modify the AJAX response via javascript • Use a custom response command • Perform AJAX on non-traditional events like a timer.
  • 3. We are skipping #ajax • This is the basic usage • Plenty of examples in examples.module • Too tied to the form id and cache
  • 4. Responding to an AJAX request
  • 5. Drupal’s AJAX Commands • http://api.drupal.org/api/drupal/includes--ajax.inc/group/ajax_commands/7
  • 6. Simplest Example • <a href="/aajax-example/simple/nojs" id="aajax-example-1" class="use-ajax">Simple example</a> • l(t('Simple example'), 'aajax- example/simple/nojs', array('attributes' => array('id' => 'aajax-example-1', 'class' => 'use- ajax')))
  • 7. Second verse, same as the first <a href="/aajax-example/simple/nojs" id="aajax- example-2" class=“aajax-example use-ajax">Simple example 2</a>
  • 8. Setting up the AJAX event • Use Drupal’s behavior • Bind to a DOM object • Fill in the element_settings • Register the Drupal.ajax object
  • 9. Element Settings Also: • wrapper
  • 10. Let’s see this again <a href="/aajax-example/simple/nojs" id="aajax- example-2" class=“aajax-example use-ajax">Simple example 2</a>
  • 11. Manipulating the response
  • 12. Custom AJAX Command Javascript side PHP Side
  • 13. What about things that are not clicks?
  • 14. Wrapping up • This framework can integrate into strong javascript applications. • Server can be used for storage, rendering and decision making. • Client can be more interactive. • Framework can add additional CSS and javascript to page automatically.

×