Results 1 to 2 of 2

Thread: string problem in server side dynamic javascript

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2003
    Posts
    175

    string problem in server side dynamic javascript

    Hi all
    Im generating javascript string in the server. the string is depends of variables which stored in datareader. im looping through the darareader (which source is MS access file) and while doing that, generating the Javascript section as string. Then sending the Javascript to the client. my problems begin with fields that has apostrophe, quatations (ex. No', "year" etc) - how can i deal with that.???? and where to deal with that (in the SQL transact, coding store proc., code behind that generates the script??? ....)
    Thanks alot

  2. #2
    Frenzied Member dj4uk's Avatar
    Join Date
    Aug 2002
    Location
    Birmingham, UK Lobotomies: 3
    Posts
    1,131

    Re: string problem in server side dynamic javascript

    You need to escape the characters.

    'Jim says it's ok' is obviously going to break.

    In JavaScript I believe \ is the escape character so:
    'Jim says it\'s ok' would work fine.

    Does that cover it?

    DJ

    If I have been helpful please rate my post. If I haven't tell me!

Posting Permissions

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



Click Here to Expand Forum to Full Width