[英]Xcart: Using ajax calls in template - 403 Forbidden Error
我正在嘗試使用Ajax將一些數據從smarty模板傳遞到php文件。
在javascript模板中:
$(document).ready(function() {
$(".redeem-button").click(function(){
var test = 'test';
$.ajax({
url: 'modules/Custom/ajaxtest.php',
data: {test: test},
type: 'POST',
success: function (data) {
$(".apply-left").html(data);
}
});
});
});
測試時,我在控制台中收到此錯誤:
POST http://localhost/xcart/modules/Custom/ajaxtest.php 403 (Forbidden)
我嘗試添加:
require_once 'http://localhost/xcart/auth.php';
在ajaxtest.php中,但仍然沒有運氣...
我該如何運作?
版本4.7.6 X-cart金色
可能的原因是
aim-server[~/www/xcart_4_6_x]$ cat modules/.htaccess
Deny from all
在這種情況下,請將此代碼添加到模塊/Custom/.htaccess文件中
Order Deny,Allow
<Files "*">
Deny from all
</Files>
<FilesMatch "^ajaxtest\.php$">
Allow from all
</FilesMatch>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.