Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

★ The quickest JavaScript asynchronous callback function ★

branch: master
Octocat-spinner-32 tests Added tests September 03, 2012
Octocat-spinner-32 .gitignore Added test September 03, 2012
Octocat-spinner-32 .jshintrc Release 0.0.1 September 03, 2012
Octocat-spinner-32 Readme.md added badge October 21, 2013
Octocat-spinner-32 async.js Release 0.0.1 September 03, 2012
Octocat-spinner-32 async.min.js Release 0.0.1 September 03, 2012
Octocat-spinner-32 index.html Changed link to jQuery instead of Loggly September 04, 2012
Readme.md

Gittip

JavaScript Async Callback 0.0.1

DO NOT USE THIS: See this HN thread for more details: http://news.ycombinator.com/item?id=4473121.

USE THIS INSTEAD: https://gist.github.com/3620903#comments

<1kb global helper function called _async, which loads external scripts asynchronously with callbacks.

Works across all browsers, see Compatibility.

Live Demo

View the live demo.

Quick Start

Add the script to the <head> of your document (or before all other scripts using _async):

<script src="//raw.github.com/niftylettuce/javascript-async-callback/master/async.min.js"></script>

Then asynchronously load a script with a callback function:

(function liveDemo() {
  var src = '//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js'
  function callback() {
    alert('It works!')
  }
  _async.load(document, src, callback)
}())

... and you're done!

Compatibility

IE FF Chrome Safari Opera iOS Opera Mini Android Blackberry Opera Mobile Chrome Android Firefox Android
5.5+ ✓ 2.0+ ✓ 4.0+ ✓ 3.1+ ✓ 9.0+ ✓ 3.2+ ✓ 5.0+ ✓ 2.1+ ✓ 7.0+ ✓ 10.0+ ✓ 18.0+ ✓ 15.0+ ✓

Contributors

License

MIT Licensed

Something went wrong with that request. Please try again.