Forum OpenACS Development: double quotes within javascript code

Request notifications

Collapse
Posted by Iuri Sampaio on
I am having troubles with double quotes " on a javascript code within a .tcl page.

I wrote the following code
See example 1 http://pastebin.com/At9NNkB5

I opened and closed the src block of the last ad_proc template::head::add_javascript with curly braquets {} instead of double quotes "", because otherwise it would throw the error:

extra characters after close-quote
while executing
"template::head::add_javascript -script "

The reason is because the javascript chunk uses double quotes along its source code.

However, if I use curly braquets the javascript doesn't work properly. No errors appear but the images aren't loaded as expected. And that I have no idea why.

1) I tried to open and close the block using double quotes and add the slash char before each double quote along the code but it doesn't work either.

See example 2 http://pastebin.com/At9NNkB5

2) I tried to use single quotes but that doesn't work as well

Does anyone have any idea how to solve that?

p.s. The code works surely. I wrote the same code within an html to ratify that.

Collapse
Posted by Ryan Gallimore on
Hi Iuri,

Try moving your JS block to a separate file.

Collapse
Posted by Iuri Sampaio on
Thanks Ryan,

I had forgotten this alternative.
It works now :)