好的,我相信这很容易,但我可能有点傻,似乎无法理解它。
我正在尝试从名为“custom.js”的js文件中对“helpers.php”中的一些代码进行简单的AJAX调用。 但是,我一直收到404错误,因为我似乎没有正确遍历文件夹,尽管我确信我已经做到了...
我拥有的文件夹结构如下:
html
index.php
js/
custom.js
includes
helpers.php
我正在JS中使用的代码:
$(document).on('ready', function() {
$.ajax({
type: "POST",
dataType: "json",
url: "../../includes/helpers.php",
data: { func: "results", days: "7"},
success: function(rows) {
console.log(rows);
}
});
});
但是在控制台中,我得到了以下输出:
The requested URL /includes/helpers.php was not found on this server.
我哪里做错了,非常感谢任何指导意见...
../includes/helpers.php
作为 URL 了吗?我认为那应该可以。 - jeroenvisser101