[thelist] dynamic data in js string

Sam-I-Am sam at sam-i-am.com
Tue Oct 16 17:15:40 CDT 2001

I'm working with a template that gets its data from a database via a php
templating layer. (which is all fine). But for this particular template
I need to insert some of the data into a javascript variable assignment.
Trouble is the data comes with a carriage return. So I start with: 
	var str = '<? getMeSomeValue() ?>';

and I get:
	var str = '

which then thows an unterminated string constant error in my browser. 
Is there another way or do I need to go back to the server-side code
(big PIA) to strip the carriage return? I can't chop the last character
off on the client side because I can't complete the variable (string)
assignment without causing an error. 

grasping at straws,

More information about the thelist mailing list