我正嘗試在Rails項目的ruby中讀取JavaScript中的服務器文件。Javascript讀取服務器文件GET http:// localhost:3000/public/uploads/goodj.json 404(未找到)
$.ajax({
url: "/public/uploads/goodj.json",
success: function (file_content) {
console.log(file_content);
}
});
,這會導致錯誤
GET http://localhost:3000/public/uploads/goodj.json 404(未找到)
我認爲服務器識別該請求作爲控制器的動作。
如何才能讓服務器瞭解這是讀取文件的請求?