Expand my Community achievements bar.

SOLVED

how to evaluate JSON file in JS file not in dialog listener JS?

Avatar

Level 3

I need to evaluate JSON file kept on some path in JS file.

path = "/apps/ademo/components/structure/basepage/mapp.json";

Like in dialog listener JS , we do -    var x = CQ.shared.HTTP.eval(path);

I want to evaluate in component specific JS file.

(When i use  "CQ.shared.HTTP.eval(path)" in component specific JS file, it gives an error as )

Please assist.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Define clientlib(javascript file) which would define a function(javascript is all about functions) which would do the instructions you require to execute.

Run you function both in Author mode and Publisher mode.

Make sure you include your clientlib in both modes is added to your html.

Regards,

Peter

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

Define clientlib(javascript file) which would define a function(javascript is all about functions) which would do the instructions you require to execute.

Run you function both in Author mode and Publisher mode.

Make sure you include your clientlib in both modes is added to your html.

Regards,

Peter