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.
SOLVED

Parse json url in javascript to get options in RTE from data source

Avatar

Level 2
I am trying to get options values from "/etc/acs-commons/lists/list/_jcr_content.list.json"  in RTE dropdown.
Experiencing Adobe Experience Manager - Day CQ: AEM 63 - Touch UI Extend Rich Text Link Dialog, Add ...  I am going through this but trying to get options parsing from datasource. Please help me how to get those values in this funtions getLinkRelOptionsHtml().
1 Accepted Solution

Avatar

Correct answer by
Level 2

This worked for me

$.ajax({ url: "/etc/acs-commons/lists/list/_jcr_content.list.json",

        dataType: 'json',

        async: false,

        success: function(data) { $.each(data, function(i,value) { html = html + getOptionHtml(value); }); } });

View solution in original post

5 Replies

Avatar

Level 10

This article has a package - did you install the package to get this example working.

Avatar

Level 2

Thanks donald. This example is working fine. I wanted to get options from data source i.e from an admin screen.

Avatar

Level 10

Not sure if this helps in what you're looking for --

$.getJSON( "/etc/acs-commons/lists/list/_jcr_content.list.json", function( data ) {

JSON.parse(data); 

// do something with parsed values or inject it into RTE DOM

});

Avatar

Level 10

Gaurav is correct - you need to implement JavaScript logic.

Avatar

Correct answer by
Level 2

This worked for me

$.ajax({ url: "/etc/acs-commons/lists/list/_jcr_content.list.json",

        dataType: 'json',

        async: false,

        success: function(data) { $.each(data, function(i,value) { html = html + getOptionHtml(value); }); } });