Render content which can be refreshed via Ajax.
Objectives and Prerequisites
You will need the following knowledge and skills. If you need a review, check out the 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.
Summary
- Any Ajax-related functionality needs to be well thought out.
- We can render views programmatically to create custom content in pages.
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)