包括另一HTML文件在HTML文件的单页应用程序
-
21-12-2019 - |
题
我还有小的要求,我希望包括productresults.html 文件在productsearch.html 在durandal(单页应用程序)。任何一个可以帮助我这个,我试过以下方式。
<link rel="components" href="productResults.html">
<!--#include virtual="productSearch.html" -->
谢谢,
湿婆
解决方案 2
感谢您的支持和信息。
最后代码片段在水疗中心为我工作。
<!--ko compose: {view: 'nav'} -->
<!--/ko-->
. 其他提示
使用jQuery的解决方案:
<html>
<head>
<script src="jquery.js"></script>
<script>
$(function(){
$("#includedContent").load("productResults.html");
});
</script>
</head>
<body>
<div id="includedContent"></div>
</body>
</html>
.
希望这有帮助。
什么你想要做的是 服务器包括侧.
你的网服务器必须配置,以支持它-它听起来像也许你的服务器是不是?
这也有可能你的网站服务器可能需要的文件有一个特别的后缀,例如"productSearch.shtml".
你可以在这里寻找更多的细节:
不隶属于 StackOverflow