我正在尝试在javascript < - > php通信中应用一个简单的转义过程.我不工作......我不知道为什么.
这是我写的一些测试代码:
<head>
<meta charset='utf-8'>
<title>Test</title>
</head>
<body>
<script>
JSON.parse('[{"id":"43","english":"ar\"m","korean":"\ud314","date":"49 minute(s) ago."}]');
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
转义字符是单词arm中的双引号.打开页面时返回的错误是:
VM84:1 Uncaught SyntaxError: Unexpected token m in JSON at position 26
at JSON.parse (<anonymous>)
at test.html:11
(anonymous) @ test.html:11
Run Code Online (Sandbox Code Playgroud)