Dynamically Load Content Into A Container with jQuery

File Size: 5.34 KB
Views Total: 22624
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
Dynamically Load Content Into A Container with jQuery

Dynamic Load Content is a simple jQuery snippet which allows to dynamically load external resources into an container without leaving or refreshing the current page.

How to use it:

1. Include the required jQuery javascript library in the page.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>

2. Create a link to load an external page into container 'dynamic'

<a href="page1.html">Page 1</a>

<section id="dynamic"></section>

3. The jQuery script. Use jQuery load() function to load data from the server and place the returned HTML into the matched element.

$(document).ready(function(){
$('a').click(function(e){
e.preventDefault();
$("#dynamic").load($(this).attr('href'));
});
});

This awesome jQuery plugin is developed by PableraShow. For more Advanced Usages, please check the demo page or visit the official website.