Is there any reasons why PHP\'s json_encode function does not escape all JSON control characters in a string?
For example let\'s take a string which spans two rows a
There are 2 solutions unless AJAX is used:
Write data into input like and read it in JS:
Use addslashes
var json = '= addslashes(json_encode($data)) ?>';