Hi,
I have a placeholder that saves the id of a database register. The problem is that I don not know how to get its value in a javascript script.
I tried to create a snippet, to use the getplaceholder function but it does not work.
I can get the value before the <script> tag but not inside.
The script is in a document’s content.
Does anybody know how to solve it??
Thanks in advance.
-
MODX Staff
- 10,725 Posts
A code example would be useful here. I’m not understanding what you are attempting to do. You certainly can’t use getPlaceholder as a javascript function, but you can certainly put placeholders in the output to be replaced when the page is served by MODx, regardless if the output is pure HTML or HTML and javascript.
I solved it using a snippet that reads the placeholder’s value:
var user = [[id_user]];