Calling Multiple html's into single HTML file

Hello,

I had one requirement and the below is the scenario.

Scenario:

I have 5 html pages would like to call them in a single html page, after some research I found we can call using jquery .load method. Can anyone suggest is there any best way to do it, most probably I am looking to call them using JSON.

Thanks.

The best way to do it is on the server before the page is delivered to the browser.

If you’re using JSON, then you need to load the data and build the html within the JavaScript.

If you just want to load html from another file, jQuery’s .load is about as easy and straightforward as it gets.

<div id="content1"></div>
<div id="content2"></div>
<div id="contentn"></div>

<script>
    $('#content1').load('content1.html');
    $('#content2').load('content2.html');
    $('#contentn').load('contentn.html');
</script>

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.