json - PHP string syntax error in data attribute -
this correct syntax <div class="d" data-slick='{"slidestoshow": 4}'>
and php code $output .= '<div class="fashmag-gallery-half" data-slick="">';
i have tried no luck, what's wrong here?
$output .= '<div class="fashmag-gallery-half" data-slick="{"slidestoshow": 4}">';
the problem here generated html not have escaped quotes data-slick="{"slidestoshow": 4}"
cause syntax error. try escaping them data-slick="{\"slidestoshow\": 4}"
or better yet remove quotes object inside this: data-slick="{ slidestoshow: 4}"
Comments
Post a Comment