A simple script to asynchronously include content on an HTML page with simple markup that “just works”.
Just include the
async-include.js file on your page and it will asynchronously replace elements that have a
data-async-url attribute with the contents of requesting that url.
This is intended for elements that might be slow to load and are not the primary focus of a page (such as some customized sidebar content). Your page loads will be faster for you users since it will deliver the whole page before trying to load the asynchronous content and it should often look like one regular page load to the user.
You can optionally try out some of the features in
async-include-extra.js, which let’s you include the following attributes:
- data-type - can be "html" for straight HTML or "json" and it will expect a json object with an
htmlattribute containing the HTML code (defaults to "html")
- data-delay - number of milliseconds to delay the load from document.ready (defaults to 0)