html - Double quote escaping with Javascript function -
json.stringify escapes double quotes. there input such following code (without modification) not result in escape of double quotes?
<script> function test(s) { document.write(json.stringify(s)); } </script> <form action="" method="post" onsubmit="test(this.cmd.value); return false;"> <input class="command" type="text" id="cmdbox" name="cmd" /> </form>
example input/output:
"test"
expected:
"test"
actual:
\"test\"
use unescape escaped string expected result.
unescape(json.stringify(data))
Comments
Post a Comment