Skip to content

Instantly share code, notes, and snippets.

@ChrisBuchholz
Created September 29, 2010 08:43
Show Gist options
  • Save ChrisBuchholz/602470 to your computer and use it in GitHub Desktop.
Save ChrisBuchholz/602470 to your computer and use it in GitHub Desktop.
(function() {
var CDB = function(url, callback) {
if(url != 'undefined' && callback != 'undefined') {
this._url = url;
this._callback = callback;
this.send(this._url, this._callback);
}
};
CDB.prototype = {
send: function(url, callback) {
var scpt = document.createElement('script'),
uri = url + '?callback=' + this._callback;
scpt.setAttribute('src', uri);
document.body.appendChild(scpt);
}
};
someTest = function(something) {
alert(something);
}
var test = new CDB('__SOME_URL_TO_SOME_JSON__', 'someTest');
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment