我使用這個jQuery的AJAX腳本發送電子郵件:只有當我指定文件路徑
$.ajax({
url: process.php,
type: "POST",
data: data,
cache: false,
...
在url
我打電話發送電子郵件的PHP文件,但阿賈克斯得到它完整路徑:
url: "http://www.domain.com/wp-content/themes/site_theme/templates/process.php",
但我不得不使用這樣的語法:
url: "../../templates/process.php",
,或者使用一個變量來聲明我n中的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
w ^我錯了嗎?
更換
解決 「模板/ process.php」,'? – jtheman 2013-04-29 08:23:29
指定完整路徑有什麼問題? – Musa 2013-04-29 08:37:44
@jtheman:用你的解決方案,它檢索到這個錯誤'POST http://www.domain.com/contact-page/templates/form-contatti-mail.php 404 Not Found 1。34s' – 2013-04-29 08:43:55