Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Senior Coder nikos101's Avatar
    Join Date
    Dec 2006
    Location
    London
    Posts
    1,005
    Thanks
    58
    Thanked 10 Times in 10 Posts

    unterminated string literal

    I keep getting this error and I'm not sure why

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

    unterminated string literal
    [IMG]chrome://firebug/content/blank.gif[/IMG]var flashvars = {'regkey':"<br />\n


  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,020
    Thanks
    75
    Thanked 4,323 Times in 4,289 Posts
    I think it is telling you the problem.

    After you do the PHP-based substitution, your JS code ends up looking like this:
    Code:
    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??
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • Users who have thanked Old Pedant for this post:

    nikos101 (12-05-2009)

  • #3
    Senior Coder nikos101's Avatar
    Join Date
    Dec 2006
    Location
    London
    Posts
    1,005
    Thanks
    58
    Thanked 10 Times in 10 Posts
    its really weird:

    the url is like this:

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

    where are the br coming from


  • #4
    Senior Coder nikos101's Avatar
    Join Date
    Dec 2006
    Location
    London
    Posts
    1,005
    Thanks
    58
    Thanked 10 Times in 10 Posts
    seems like fire bug is putting junk in the page


  • #5
    Senior Coder nikos101's Avatar
    Join Date
    Dec 2006
    Location
    London
    Posts
    1,005
    Thanks
    58
    Thanked 10 Times in 10 Posts
    Quote Originally Posted by Old Pedant View Post
    I think it is telling you the problem.

    After you do the PHP-based substitution, your JS code ends up looking like this:
    Code:
    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


  • #6
    Senior Coder nikos101's Avatar
    Join Date
    Dec 2006
    Location
    London
    Posts
    1,005
    Thanks
    58
    Thanked 10 Times in 10 Posts
    Quote Originally Posted by nikos101 View Post
    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 />


  • #7
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,020
    Thanks
    75
    Thanked 4,323 Times in 4,289 Posts
    LOL! Those kind of things are always "fun". Right up there with pulling teeth and getting sunburned.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •