如果我的文件位於不同文件夾中,如何使用.load
?Jquery.load來自不同文件夾的URL
我曾嘗試:
$("#messageWindow").load("http://localhost/MainFolder/Messanging/index.php");
$("#messageWindow").load("Messanging/index.php");
$("#messageWindow").load("../Messanging/index.php");
實在不行,我一直在使用的URL,但我似乎無法讓自己的答案上班的時候讀到different folders
話題。
謝謝。
好的,我已經修復了問題The 1st and 2nd URL above WORKS
但我有另一個問題。 index.php
有大量的網址。
<script type="text/javascript" src="../js/jquery-1.7.2.min.js"></script>
<script src="../plugins/ui/jquery.ui.core.js"></script>
<script src="../plugins/ui/jquery.ui.widget.js"></script>
<script src="../plugins/ui/jquery.ui.datepicker.js"></script>
<script src="../plugins/timezone/jstz.min.js"></script>
<script type="text/javascript" src="file_js/index.js"></script>
但現在這些URLS不再工作,我採取的解決方案是添加整個URL。
<script type="text/javascript" src="http://localhost/MainFolder/js/jquery-1.7.2.min.js"></script>
<script src="http://localhost/MainFolder/plugins/ui/jquery.ui.core.js"></script>
<script src="http://localhost/MainFolder/plugins/ui/jquery.ui.widget.js"></script>
<script src="http://localhost/MainFolder/plugins/ui/jquery.ui.datepicker.js"></script>
<script src="http://localhost/MainFolder/plugins/timezone/jstz.min.js"></script>
<script type="text/javascript" src="http://localhost/MainFolder/Messanging/file_js/index.js"></script>
這是一個喧囂,如果我上傳文件到我的虛擬主機。我認爲使用相對路徑會做到這一點,但我不知道它是如何工作的。
你在'console' \ firebug'中看到了什麼? – gdoron
Messanging?可能是消息傳遞 –
我認爲你需要提供進一步的細節。首先,瀏覽器的網址是否工作(「http://localhost/MainFolder/Messanging/index.php」)?其次,你是否嘗試過使用同一個文件夾中的網址?還有一件事是:「Messanging」拼寫爲文件夾的名稱? (對不起,如果最後一個看起來有點愚蠢,但我已經做了很多這樣的錯誤:D) – Mircea