[Solved] jQuery return all Array [closed]


You’re overwriting templateArray in each iteration. Try .map() instead of each():

var templateArray = $.map(Basepath.Templates, function(tpl, i){
    return {
        title: tpl.Template.name,
        src: 'view/'+tpl.Template.id,
        description: tpl.Template.name
    };
});
console.log(templateArray); // now is only one array, containing template objects;

3

solved jQuery return all Array [closed]