Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Escape sequence inside javascript  RSS feed

 
Ashutosh Arya
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi I have to pass some value with (') inside javascript in a jsp. But it is not allowing the javascript to work properly.
eg: function a('Party at Ron's house')
Ron's (') is not allowing the javascript to work.

Please suggest some solution.

Aashu.
 
Balu Sadhasivam
Ranch Hand
Posts: 874
Android Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ashutosh,

the escape character sequence '\' can be used here . How do you pass it JS ?
 
Shailesh Narkhede
Ranch Hand
Posts: 368
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check this Link

this may help you.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, NO! Do not URL-encode it! Do you understand at any way what the actual problem is? Do you understand what URL encoding is to be used for?

Just replace the singlequotes by escaped singlequotes before printing. You can easily use JSTL's fn:replace function for this.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!