Skip to content
A super simple way to asynchronously include content on your page
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Async Include

A simple script to asynchronously include content on an HTML page with simple markup that “just works”.

<div data-async-url="/some-url/"></div>

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 html attribute containing the HTML code (defaults to "html")
  • data-delay - number of milliseconds to delay the load from document.ready (defaults to 0)
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.