我有index.html页面,我通过jquery load funtion(它是html页面的页眉内容,如菜单和我的网站的子菜单)加载页面headercontent.html它工作很好。但我有一些名为 pc - > samsung-printers service.html的文件夹的html页面,在这个页面中加载函数不会加载headercontent.html。我曾尝试serveral的路径一样......html页面的路径从一个文件夹中加载它
$("#includefile").load("headercontent.html");
or
$("#includefile").load("..headercontent.html");
or
$("#includefile").load("./headercontent.html");
or
$("#includefile").load("../headercontent.html");
例如: 我有一个网站的页面(网站目录结构。)
index.html
headercontent.html(this page is loaded in every page bcoz this header
content)
plan.html
now there is folder named PC
PC
->care.html
code of care.html
<html>
<head>
<script
src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js">
</script>
<script>
$(function()
{
$("#includefile").load("headercontent.html");
});
</script>
</head>
<body style="overflow:hidden">
<div class="pageWrapper">
<header class="headermenus" id="includefile">
</header>
</div>
</body>
</html>
应该是什么我的头的确切路径。 html文件,可以在care.html页面中成功加载。
在此先感谢..
为什么你不使用完整的文件路径? – guest271314
如何根据我的目录结构使用完整路径.. –
只有你知道文件夹和文件的完整路径。例如,''“http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js”是文件'“jquery.min.js”' – guest271314