I am generating links from json files on the client side.
loadSubjects = function() {
return importData("themen", function() {
var i, _i, _ref, _results;
_results = [];
for (i = _i = 0, _ref = data.themen.themen.length - 1; 0 <= _ref ? _i <= _ref : _i >= _ref; i = 0 <= _ref ? ++_i : --_i) {
$("#subjectBtns").append('<a href="javascript:generateSubjectOverview("' + data["themen"]["themen"][i]["dateiName"] + '");" class="btn btn-mghg">' + data["themen"]["themen"][i]["name"] + '</a>');
console.log('appending: ' + '<a href="javascript:generateSubjectOverview("' + data["themen"]["themen"][i]["dateiName"] + '");" class="btn btn-mghg">' + data["themen"]["themen"][i]["name"] + '</a>');
_results.push(false);
}
return _results;
});
};
I also tired onlick instead of href, but that also didnt work. I am getting the error:
Uncaught SyntaxError: Unexpected end of input
The javascript code looks somewhat messy, but that is, because it´s generated by coffeescript.
the function importData is just a short hand for $.getJSON with the path and the callback
returnthere is to return thejqXHRobject (or possibly another promise of some kind). Ben is passing in a callback. (Hmmmm... But then, whyreturn _results;at the end of the callback? MaybeimportDatadoes something with that.)importDatais just shorthand for$.getJSON. Unless it's wrapping the callback in another function that does something with the return value, it won't be used.return _results;is just because i am writing in coffeesctipt. it always return the last thing in a codeblock