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

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -