I have an object in the frontend and need to pass this value to the backend (PHP).
Frontend:
var cfg = {"tooltips":true,"tooltipTemplate":"<div></div>"},
jsonCfg = JSON.stringify(cfg);
$inputConfig.val(jsonCfg);
$form.submit();
Backend:
$config = $_POST['config'];
$json = json_decode($config);
echo $json->tooltips;
echo $json->tooltipTemplate;
The last string gives me only empty value, if I remove the first tag "<", I will get only "div>", but I do not understand how to prevent this behavior, I need any string without filtering or formatting.