我的文件夾結構:JavaScript不能ourside根
/public
/css
/fonts
/images
/js
index.php
/resources
/configs
/library
/scripts
/templates
我的問題是validate.js(位於/ JS)不能訪問validate.php(位於/腳本)。
$.ajax({
type: "POST",
url: "../resources/scripts/validate.php",
謝謝!
UPDATE,這裏是錯誤消息:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /resources/scripts/validate.php was not found on this server.</p>
<p>Additionally, a 404 Not Found
error was encountered while trying to use an ErrorDocument to handle the request.</p>
<hr>
<address>Apache/2.4.3 (Win32) OpenSSL/1.0.1c PHP/5.4.7 Server at localhost Port 80</address>
</body></html>
我可以將validate.php放入/ public,但目標是確保沒有人能夠訪問/ scripts中的文件。 – TimNguyenBSM
@TimNguyenBSM我認爲目標是這樣的,但如果validate.php是實現網站工作的目標所需要的,那麼目標就會有衝突。鑑於目標,我只是在ajax可以訪問的位置使用包含php文件的內容。 – Wayne
@TimNguyenBSM另一種選擇是創建一個新的validate.php,但是這會破壞在腳本中擁有validate.php的目的。 – Wayne