I have JavaScript and PHP working together fairly well except for this one error.
Only the phpVariable has () in it so I get an error in my javascript - expecting ")". How do I escape the () in JavaScript?Code:<script> if value == 1 document.write('$phpVariable'); </script>
This is just a guess...
Code:<script> if value == 1 document.write('$phpVariable\(\)'); </script>
I don't understand this. What is the \(\) doing?
if you are attempting to write a string, and your string contains (
then to escape that character would simply be \(
if your variable is a string, then you need to change that variable so that those characters are escaped in this way. Perhaps before sending the variable to the write function you can someone search for those characters and precede them with the escape character \
Ahh, I never thought about doing that. I suppose when I started combining the two I felt limited in what I could do. Thanks!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks