Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Adding Experience Fragment to Page

Avatar

Level 2

Hi,

Is there any way to add an experience fragment to a page dynamically using HTL or get requests?

I keep getting forbidden when trying to access experience fragments using get requests like in the code below :

     function getFragment(path) {

            $.ajax({

                type: 'GET',

                url: path,

                success: function(xf) {

                    $("#article-container")

                        .append(xf);

                }

            });

        }

Regards,

Mark

3 Replies

Avatar

Level 10

You need to make sure correct read access for that path based the current user who is trying to access XF

Avatar

Level 2

I have access to the experience fragments and I am not having the same problems with content fragments.

Avatar

Level 4

@mark_julianp181  - I am looking for similar solution to load the XF content based on the drop down selection, In the JCR node, I have only the reference path of the XF variation only. Not sure how to get the complete DIV of the XF to replace the content on the page. Please provide your inputs if you have already implemented this solution.