function asyncData(url, callback) { var script = document.createElement('script'); script.src = url; script.onload = function () { if (typeof callback == "function") callback(); callback = null; }; script.onreadystatechange = function () { if (script.readyState == 4 || script.readyState == "complete") { if (typeof callback == "function") callback(); callback = null; } }; document.getElementsByTagName('head')[0].appendChild(script); } // Test! asyncData('https://apis.google.com/js/plusone.js?nocache=' + (new Date().getTime()), function () { alert('Loaded!'); });