title: use php inside JavaScript
body: <p>I have an ajax function that post to an PHP file.
  Now since I'm using WordPress I can use the get_url function so I don't need to hard code the entire URL.</p>
  
  <p>The WordPress function is an PHP so I'm trying to use PHP inside the ajax post. But it wont do the trick.
  Any ideas ? and is it possible ?</p>
  
  <p>This is what I have.</p>
  
  <pre><code>$(document).ready(function(){
  
  $('#submit').click(function(){
  
  $.post('&lt;?php echo get_template_directory_uri(); ?&gt;/send.php', $("#mycontactform").serialize(),  function(response) {
  $('#success').html(response);
  //$('#success').hide('slow');
  });
  return false;
  
  });
  
  });
  </code></pre>
  
  <p>I have also tried the php echo inside quotes like this.</p>
  
  <pre><code>   $.post(' "&lt;?php echo get_template_directory_uri(); ?&gt;" /send.php' ....
  </code></pre>
  
  <p>ether  way I get this path</p>
  
  <pre><code>http://mysite.com/%27%3C?php%20echo%20get_template_directory_uri();%20?%3E%27/send.php&amp;email=&amp;message=&amp;name=&amp;sent=1
  </code></pre>