javascript - PHP need to output ' instead of ' -
i have issue jbar it's outputting ' , causing javascript break. code is:
<div class="jbar" data-init="jbar" data-jbar='{ "message" : "<?php echo $myann->getvalue("heading", 0); ?>", "button" : "<?php echo $myann->getvalue("buttontext", 0); ?>", "url" : "<?php echo $myann->getvalue("buttonurl", 0); ?>", "state" : "open" }'></div>
if manually type in:
"message" : "my name's test",
this breaks still. if type in:
"message" : "my name's test",
this works!
so... how can php echo utilize ' instead of '? i've tried htmlspecialchars , addslashes neither work.
thanks.
from documentation:
"'" (single quote) becomes ''' (or ') when ent_quotes set.
so
echo htmlspecialchars($input, ent_quotes);
javascript php apostrophe
No comments:
Post a Comment