0

I have small requirement that i want to include productresults.html file in productsearch.html in durandal(Single Page Application). Can any one help me on this and i have tried the following ways also.

<link rel="components" href="productResults.html">
<!--#include virtual="productSearch.html" --> 

Thanks,
shiva

Siva P
  • 109
  • 1
  • 12
  • What you're trying to do is a [Server side include](http://www.boutell.com/newfaq/creating/include.html). Your web server must be configured to support it - it sounds like maybe your server isn't? – paulsm4 Nov 18 '13 at 05:08

3 Answers3

4

Solution using jQuery:

<html> 
  <head> 
    <script src="jquery.js"></script> 
    <script> 
    $(function(){
      $("#includedContent").load("productResults.html"); 
    });
    </script> 
  </head> 

  <body> 
     <div id="includedContent"></div>
  </body> 
</html>

Hope this helps.

Ranveer
  • 6,683
  • 8
  • 45
  • 92
0

Thanks for your support and information.

Finally the code snippts works fine for me in SPA.

<!--ko compose: {view: 'nav'} -->
<!--/ko-->
Siva P
  • 109
  • 1
  • 12
-1

What you're trying to do is a Server side include.

Your web server must be configured to support it - it sounds like maybe your server isn't?

It's also possible your web server might require the file to have a special suffix, e.g. "productSearch.shtml".

You can look here for more details:

paulsm4
  • 114,292
  • 17
  • 138
  • 190