Coder
Coder

Reputation: 1139

How can I place Coldfusion code into a JavaScript variable

I would like to place some ColdFusion code into a javascript variable. Please could someone advise how this can be done.

The ColdFushion code is as follows:

#LabelOverride::get('person')#

Upvotes: 0

Views: 99

Answers (1)

Sev Roberts
Sev Roberts

Reputation: 1295

A literal answer to your question would be something like:

<script>
var myJsVariable = '#EncodeForJavascript(LabelOverride::get("person"))#';
</script>

But if you're asking this question, I think there's a chance it's not going to behave quite how you might be hoping.

Upvotes: 4

Related Questions