Javascript Xcart:在模板中使用ajax调用-403禁止错误
我试图使用Ajax将一些数据从smarty模板传递到php文件 在javascript中的模板中:Javascript Xcart:在模板中使用ajax调用-403禁止错误,javascript,php,ajax,smarty,x-cart,Javascript,Php,Ajax,Smarty,X Cart,我试图使用Ajax将一些数据从smarty模板传递到php文件 在javascript中的模板中: $(document).ready(function() { $(".redeem-button").click(function(){ var test = 'test'; $.ajax({ url: 'modules/Custom/ajaxtest.php', data: {test
$(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 Gold可能的原因是
aim-server[~/www/xcart_4_6_x]$ cat modules/.htaccess
Deny from all
在这种情况下,将此代码添加到
modules/Custom/.htaccess文件
Order Deny,Allow
<Files "*">
Deny from all
</Files>
<FilesMatch "^ajaxtest\.php$">
Allow from all
</FilesMatch>
订单拒绝,允许
全盘否定
通融
可能的原因是
aim-server[~/www/xcart_4_6_x]$ cat modules/.htaccess
Deny from all
在这种情况下,将此代码添加到
modules/Custom/.htaccess文件
Order Deny,Allow
<Files "*">
Deny from all
</Files>
<FilesMatch "^ajaxtest\.php$">
Allow from all
</FilesMatch>
订单拒绝,允许
全盘否定
通融