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

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -