To save time debugging $ .each, two arguments to the callback function are required: an iterator and an actual object
$.getJSON('/myserver/templates.json', function (templates) { $.each(templates, function (id, template) { ich.addTemplate(template.name, template.template); }); });
Of course, you must remember what you promise, as these templates are loaded in asynchronous mode.
source share