Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I have 2 blocks to be loaded by ajax.
The AJAX request looks like this:
mywebsite.com/ajaxblocks?blocks=block1/block2
The success function looks like this:
success: function (data) {
// Replaces the placeholder divs by the actual block contents returned by the AJAX call,
// executes the extra JavaScript code and attach behaviours if the apply to the blocks.
Drupal.freezeHeight();
for (var id in data) {
console.log("Worked");
Drupal.ajaxblocksSetBlockContent(id, data[id]);
}
Drupal.unfreezeHeight();
}
And the returned json looks like this:
{"block1":{"content":"my block content","ajaxblocks_settings":""},"block2":{"content":"my second block content","ajaxblocks_settings":""}}
Now only the first block (block1) is loaded. Why is this? The for-loop doesn't seem to work properly
Comments