I want to execute a callback once I load a script using pure javascript. I am able to load the script correctly, but my callback is not firing. I heard using JSONP I can do this type of stuff, however, I cannot quite get it to work. Here is my code:
function foo(){
alert('got the data');
}
var el = document.createElement("script");
el.setAttribute("src", "//ajax.googleapis.com/ajax/libs/webfont/1.5.0/webfont.js?callback=foo");
document.body.appendChild(el);