Mar 27, 2013 - General Web Development    Comments Off on Include content from an external web page into an existing page

Include content from an external web page into an existing page

Here are different ways to include content from an external web page into an existing page.

ASP Server Side Includes

Insert the following HTML code to retrieve the contents of the external page

<html>
<!--#include file="/url/page.html"-->
</html>

Javascript

Insert the following Javascript code to retrieve the contents of the external page

<html>
<div id='result' class='ifneeded'></div>
<script>
    $.get('/url/page.html', function(data) {
        $('#result').html(data);
    });
</script>
</html>

This will grab the contents of the page located at /url/page.html, parse the data as “html” and load it into the DIV with an ID of “results”