Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A super simple way to asynchronously include content on oyur page

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 demo
Octocat-spinner-32 README.md
Octocat-spinner-32 async-include-extra.js
Octocat-spinner-32 async-include-extra.min.js
Octocat-spinner-32 async-include.js
Octocat-spinner-32 async-include.min.js
README.md

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)
Something went wrong with that request. Please try again.