javascript - Chrome - Unexpected token Illegal. Firefox und. string literal -
i have following script:
jquery('#content-page-<?php echo $post->id ?>') .data('content','<div class="page-content"><?php echo $post->post_content; ?>'); in
'<div class="page-
the
'
symbol not understood correctly , the
uncaught syntaxerror: unexpected token illegal
and
unterminated string literal
error in chrome , firefox.
what problem?
update 1
the
<?php echo $post->post_content; ?>
how handle multiline text? problem seems in multiline.
are there apostrphes in php output? if remember becomes "raw text" if echos "i'm bob" it'll render 'content',';i'm bob' (notice middle quote). should use addslashes($post->$post_content) http://php.net/manual/en/function.addslashes.php escape output.
Comments
Post a Comment