Path to WordPress Template Directory inside jQuery?

Posted by Norbert on Stack Overflow See other posts from Stack Overflow or by Norbert
Published on 2010-05-18T11:07:03Z Indexed on 2010/05/18 11:10 UTC
Read the original article Hit count: 308

My header is calling a javascript file which sends out an email:

<script type="text/javascript" src="<?php bloginfo('template_directory') ?>/css/effects.js"></script>

But inside this file, I have a jQuery code that calls a .php file that does the actual sending of the email:

$.ajax({
  type: "POST",
  url: "css/sendmail.php",
  data: dataString`

But the script doesn't work, unless the url is:

<?php bloginfo('template_directory') ?>/css/sendmail.php

and not just:

css/sendmail.php

Is there any way to include a path to the wordpress template directory inside js?

© Stack Overflow or respective owner

Related posts about wordpress-theming

Related posts about jQuery