Wednesday 15 May 2013

javascript - how to save html to variable? -


I try to save wysiwyg data in one variable but I receive an error message

"Unwanted syntax error: Unexpected token invalid"

And I can not get my head around it ... I can fix everything in the console, okay Whatever may be the error.

Javascript

  var temp = "& lt ;? php echo $ pressDescription?"  

console enter image details here

You must avoid characters that have special meaning or are not allowed in Javascript string literal (like new line).

json_encode function will do this for you.

  var temp = & lt ;? Php echo json_encode ($ pressDescription); ? & Gt ;;  

No comments:

Post a Comment