...

View Full Version : unterminated string literal



nikos101
12-05-2009, 07:00 PM
I keep getting this error and I'm not sure why

var flashvars = {'regkey':"<?php $_GET[regkey]?>",'pkey':"<?php $_GET[pkey]?>"};

unterminated string literal
chrome://firebug/content/blank.gifvar flashvars = {'regkey':"<br />\n

Old Pedant
12-05-2009, 07:18 PM
I think it is telling you the problem.

After you do the PHP-based substitution, your JS code ends up looking like this:

var flashvars = {'regkey':"<br/>
something",'pkey':"whatever"};

You can't have a line break inside a string literal in JS code.

But why not simply do a VIEW==>>PAGE SOURCE and look at the HTML that is being generated to be sure??

nikos101
12-05-2009, 08:44 PM
its really weird:

the url is like this:

http://localhost/mission.org/media/?pkey=grdtgrt&regkey=wef

where are the br coming from

nikos101
12-05-2009, 08:50 PM
seems like fire bug is putting junk in the page

nikos101
12-05-2009, 09:33 PM
I think it is telling you the problem.

After you do the PHP-based substitution, your JS code ends up looking like this:

var flashvars = {'regkey':"<br/>
something",'pkey':"whatever"};
You can't have a line break inside a string literal in JS code.

But why not simply do a VIEW==>>PAGE SOURCE and look at the HTML that is being generated to be sure??
thanks. it was a notice being generate by php

nikos101
12-05-2009, 09:35 PM
thanks. it was a notice being generate by php

stuff like this

<b>Notice</b>: Undefined index: regkey in <b>C:\Users\Nikos\Documents\Computing\htdocs\mission.org\media\index.php</b> on line <b>20</b><br />
",'pkey':"<br />

Old Pedant
12-06-2009, 06:04 AM
LOL! Those kind of things are always "fun". Right up there with pulling teeth and getting sunburned.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum