In the past 2 days we have developed a custom module which demonstrates the basic Ajax implementation in Drupal 7.
Today i will continue the example written by Kevin Hankens and make the module more secure. We want to add a token in the Ajax request such that the server could check if it comes from a valid user. This token could be obtained from drupal_get_token() which will return a fixed token value for each user session. Here are the list of changes in the new eureka_ajax.module.
- Set the token value in Drupal.settings in hook_init()
- Add the token as query string in the theme_ajax_link()
- Check if the token is valid in ajax_request_callback()
Continue reading Drupal 7 – Simple Ajax implementation @ 3 →
I will continue the Ajax example which we did in
Drupal 7 – Simple Ajax implementation @ 1
So this time we will add some access control on the above example. In Drupal 7 & 8 development, we could create new permissions by implementing the hook_permission(). After that we could modify the access arguments in the hook_menu().
Continue reading Drupal 7 – Simple Ajax implementation @ 2 →
In this post, i will show you how to implement a simple Ajax function in Drupal 7. The following example code is based on the blog post written by Kevin Hankens about implementing Ajax in Drupal 6.
Kevin Hankens’s blog – Drupal, jQuery and $.ajax() easyness
What i am going to do is the same as Kevin’s example. But for simplicity, i removed the access control logic so all content is visible to anonymous users.
Continue reading Drupal 7 – Simple Ajax implementation @ 1 →
Dream BIG and go for it =)