Skip to content

@ChrisMissal /loadUnderscore.js
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Allows loading of external JavaScript files for use in on{X}
(function() {
device.ajax(
{
url: 'http://underscorejs.org/underscore-min.js',
type: 'GET',
headers: {
'Content-Type': 'text/javascript'
}
},
function onSuccess(body, textStatus, response) {
eval(body);
if (_) console.log('underscore.js loaded successfully');
yourCode(_);
},
function onError(textStatus, response){
console.error('error code: ', response.status);
});
})();
function yourCode(_) {
var stooges = [{name : 'moe', age : 40}, {name : 'larry', age : 50}, {name : 'curly', age : 60}];
console.info(_.pluck(stooges, 'name'));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.