I have some string which I get from the database called $string
I need to pass this string to a javascript function like so:
Code: Select all
<a href="#" onclick="func('<?php echo $string; ?>');">test</a>I was wondering what would be the correct and robust way to escape the string so it won't interfere with string escaping in HTML and JavaScript
regards