Created
July 16, 2013 03:28
-
-
Save zachad/6005528 to your computer and use it in GitHub Desktop.
One way to safely escape HTML when writing out JSON objects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type='text/javascript'> | |
var Search = <%= @search.to_json.gsub("/", "\/") %>; | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment