Json encoding strings with spaces
Use htmlentities
to encode the json. It will encode all the "
which was breaking attribute.
echo '<h1 id="stumped" data-stumped="'.htmlentities(json_encode($data_ar)).'">test</h1>';
Use htmlentities
to encode the json. It will encode all the "
which was breaking attribute.
echo '<h1 id="stumped" data-stumped="'.htmlentities(json_encode($data_ar)).'">test</h1>';