[英]How to write path to files in Magento? File is not found, even when I set the absolute path
大家!
我嘗試創建從Magento站點發送(到電子郵件)的自定義應用程序。
為此,我以這種方式調用post.php文件:
$('form#send-profile').submit(function(event) {
event.preventDefault();
var output = true,
array = $(this).serialize();
if (output) {
$.post('post.php', array, function(data) {
$('input[type="text"], textarea').val('');
});
};
});
我已經將post.php放到了根文件夾中(並嘗試了使用其他文件夾)。
但是在任何情況下我都會得到此結果:POST http://vescorte.com/post.php 404(未找到)
也許Magento有一些特殊的設置路徑的方法? 請告訴我,如果您知道如何解決這個問題。
在提到JS
代碼的模板文件中,可以提及Magento base URL
函數,以獲取完整的基本URL,如下所示:
$.post('<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB); ?>post.php', array, function(data) {
$('input[type="text"], textarea').val('');
});
不過,如果您遇到問題,請嘗試從post.php
刪除所有代碼,並使用簡單文本運行以檢查文件請求是否完整。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.