如果我的文件位于不同文件夹中,如何使用.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