Load Content to HTML Page from an External File

This is an example of loading an HTML page with content from an external file. This is a technique I have used on some sites and in some Word Press sites.

This script will read the contents from file1.html on the web service and load it to the content of a DIV on a page.

$(function() 
{	
	$.get( "file1.html", function( data ) {
		//$( "#Content" ).html( data ); //This Replaces  
		$( "#Content" ).append( data );   //This Appends  
 	}); 
});	

Click here for a link to the full working sample.

Comments are closed