我使用这个 jquery-ajax 脚本发送电子邮件:
$.ajax({
url: process.php,
type: "POST",
data: data,
cache: false,
...
在url
我调用发送电子邮件的 php 文件中,但只有当我指定完整路径时,ajax 才会得到它:
url: "http://www.domain.com/wp-content/themes/site_theme/templates/process.php",
但我必须使用这样的语法:
url: "../../templates/process.php",
或使用变量在 html 页眉/页脚中声明
html
<script type="text/javascript">
var urlMail = '<?php bloginfo('template_url'); ?>/templates/process.php';
</script>
脚本
url: "../../templates/process.php",
但是对于上述两种情况,浏览器控制台都会检索到此错误:
POST http://www.domain.com/templates/process.php 404 Not Found 1.56s
我哪里错了?