This page is archived
We're keeping this page up as a courtesy to folks who may need to refer to old instructions. We don't plan to update this page.
Render content which can be refreshed via Ajax.
Goal
Update the results of a view using Ajax.
Prerequisites
You will need the following knowledge and skills. If you need a review, check out the Additional resources section at the bottom of this page.
- Designing architecture to create Ajax behavior.
- Embed views programmatically.
- Return content via an Ajax request.
Tasks
Write the steps which will be involved in creating an Ajax-enabled content area. Begin with the step of getting markup of a rendered view, using the tids
from the user preferences as arguments.
Create the necessary view which will return film suggestions.
Create markup to render the film suggestions.
Ajax-enable the film suggestions area using jQuery. Use a button to trigger the Ajax request.
Recap
- Any Ajax-related functionality needs to be well thought out.
- We can render views programmatically to create custom content in pages.
Further your understanding
- Continue to the next lesson: Movie Project: Create Custom Blocks.
Additional resources
- API Documentation: Ajax Framework (api.drupal.org)
- Documentation: Ajax in Drupal using jQuery (Drupal.org)
- Video: Ajax Framework in Drupal 7 (Drupalize.Me)
- API Documentation: views_embed_view (api.drupal.org)
- Documentation: D7: Embed a Views 3's result into a page (Drupal.org)