context aware configuration inside jquery

Avatar

Avatar

srikanthg212933

Avatar

srikanthg212933

srikanthg212933

14-06-2020

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.

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

Arun_Patidar

MVP

Total Posts

2.9K

Likes

999

Correct Answer

829

Avatar

Arun_Patidar

MVP

Total Posts

2.9K

Likes

999

Correct Answer

829
Arun_Patidar
MVP

14-06-2020

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" />

Answers (1)

Answers (1)

Avatar

Avatar

Jörg_Hoh

Employee

Total Posts

3.0K

Likes

910

Correct Answer

1.0K

Avatar

Jörg_Hoh

Employee

Total Posts

3.0K

Likes

910

Correct Answer

1.0K
Jörg_Hoh
Employee

14-06-2020

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.