Created
April 27, 2009 19:29
-
-
Save jimmac/102670 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
YAST = {}; //the one global object | |
YAST.modules = { | |
// data will be pulled from JSON: | |
// group | |
// | | |
// - section | |
// | | |
// - item | |
'data': {}, | |
// 'gotData': false, | |
'readJSON': function(uri,callback) { | |
var callback = callback || function(){}; | |
var that = this; | |
//HERE | |
$.getJSON(uri, function (data) { | |
that.data = data; | |
callback(); | |
}); | |
}, | |
'render': function () { | |
var html = [], | |
data = this.data; | |
//console.log(data); | |
$.each(data, function (group, sections) { | |
html.push('<h1>', group, '</h1>'); | |
}); | |
return html.join(''); | |
}, | |
'debug': function () { | |
console.info(this); | |
} | |
}; | |
YAST.modules.readJSON('inc/fake-data.js', function () { | |
$container.html(YAST.modules.render()); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment