Wordpress theme folder inside jquery string?
<p>I want to pass the variable as a php that echoes a Wordpress theme directory url, and I have the following piece of code:</p>

<pre><code>var templateUrl = "&lt;?php echo get_template_directory(); ?&gt;";
</code></pre>

<p>and</p>

<pre><code>$(".nav").before("&lt;img alt=\"The x logo\" src="+templateUrl+"\"/icon/logo.svg\"&gt;");
</code></pre>

<p>The src I get is something like this:</p>

<pre><code>http://x.com/%3C?php...
</code></pre>

<p>Meaning it just echoes my php, instead of parsing the data and echoing something like the-theme-url/images/etc</p>

<p>What am I doing wrong?</p>