PDA

Click to See Complete Forum and Search --> : string problem in server side dynamic javascript


ronlahav
Jul 27th, 2005, 02:42 AM
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

dj4uk
Jul 27th, 2005, 04:12 AM
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