【发布时间】:2015-12-08 08:35:34
【问题描述】:
我的根目录上有一个名为 chatlogs 的文件夹(路径:root/chatlogs) chatlogs 文件夹中的 .htaccess 文件拒绝从 url 到聊天日志内容的任何请求。 现在我想允许 ajax 调用这个文件夹。 (想象一下在 chatlogs 文件夹中有一些名为 : log0.html , log1.html , ... 的文件)
htaccess:
Deny from all
我的 ajax 调用:
function loadLog(){
$.ajax( {
url: "chatlogs/log0.html",
cache: false,
success: function( html ){
$(" #chatbox ").html( html ); //Insert chat log into the #chatbox div
}
},
});
setInterval ( loadLog, 1500 );
显然 loadlog() 函数无法访问 chatlogs 文件夹。 我怎样才能允许这个 ajax 调用进入 chatlogs 文件夹?我应该在 .htaccess 文件中添加一些行吗??? 提前致谢
【问题讨论】:
-
Ajax 调用与任何其他调用没有什么不同,除了一些很容易被欺骗的发送标头。为什么要拒绝内容,却允许ajax调用,实际上和allow to all一样