Javascript error - unexpected identifier <p>I have PHP code that tries to output JavaScript and I do something like this:</p> <pre><code>trailhead_name = &lt;?php echo $objkey-&gt;trailhead_name ?&gt; + ""; </code></pre> <p>And I get the unexpected identifier error in my JS.</p>