Add oxscript with dynamic values

Hello all,
I just try to include a javascript that should contain dynamic values like this:


[{assign var="[B]test[/B]" value="test" }]
[{oxscript add='
$(document).ready(function(){alert([B]$test[/B])});'
}]

does not work so far. I googled a lot. but did not find the right way to do that.
I hope it is somehow possible…
thx and regards,
Florian

wow I just played around a bit more. it was mainly a problem with the quotes:
the script string inside double quotes makes it to work…


[{assign var="test" value="test" }]
[{oxscript add="
$(document).ready(function(){alert('$test')});"
}]

cheers,
florian

I always prepare them using a capture like this:

[{capture assign=pageScript}]
var val1 = ‘[{$myVar}]’;

[{/capture}]

[{oxscript add=$pageScript}]

[QUOTE=aggrosoft;91865]I always prepare them using a capture like this:

[{capture assign=pageScript}]
var val1 = ‘[{$myVar}]’;

[{/capture}]

[{oxscript add=$pageScript}][/QUOTE]

After having some troubles with printassis, apostrophen and dynamic data in [{oxscript add="…"}] i found this answer here. Great post! :slight_smile: