Javascript - how to echo php in javascript -
How can I get php properly inside javascript?
var timeDiff = 60-20; If (Timediff <= 60) {var stamp = timeDiff & lt ;? Php echo $ this- & gt; __ ('second first'). '.'; ? & Gt ;; }
console error:
Unwanted syntax error: unexpected identifier
This resonates 'second first' Chrome source, though after error.
Just wrapping the material that you are echoing should do it, e.g.
var stamp = timeDiff & lt ;? Php echo json_encode ($ this-> __ ('seconds ago'). '.'); ? & Gt ;;
Comments
Post a Comment