Expand my Community achievements bar.

Adobe Summit 2025: AEM Session Recordings Are Live! Missed a session or want to revisit your favorites? Watch the latest recordings now.

Mark Solution

This conversation has been locked due to inactivity. Please create a new post.

SOLVED

context aware configuration inside jquery

Avatar

Level 3

Hi 

I would want to access and read context aware configurations inside Jquery (eg: on dialog ready, inside custom coral dialog).

Could someone let me how could we achieve this ??  any example reference would be very much appreciated.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

I don't think so you can access CAC inside jquery directly. What you can do is, you can create empty div or json object with CAC value and the later access those values in jquery.

 

e.g.

<script>
var cacObj;
cacObj.key1=cacVal1;
cacObj.key2=cacVal2;

....

</script>

 

 

or 

<div data-cacKey1="cacVal1" data-cacKey2="cacVal2" />
Arun Patidar

AEM LinksLinkedIn

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

I don't think so you can access CAC inside jquery directly. What you can do is, you can create empty div or json object with CAC value and the later access those values in jquery.

 

e.g.

<script>
var cacObj;
cacObj.key1=cacVal1;
cacObj.key2=cacVal2;

....

</script>

 

 

or 

<div data-cacKey1="cacVal1" data-cacKey2="cacVal2" />
Arun Patidar

AEM LinksLinkedIn

Avatar

Employee Advisor

Hi,

 

when you refer to Context-Aware-Configuration, do you mean this: https://sling.apache.org/documentation/bundles/context-aware-configuration/context-aware-configurati...

 

If yes: jquery is executed within the browser, while CAC is executed on the server-side. Mixing both approaches directly is not possible. The only chance you have is to execute the CAC lookups on the server, and include the result into JSON or the generated HTML, and use this data then inside javascript/jquery.