function addButton(container, res) { var button = $('▶ Play'); button.click(function() { button.remove(); addPlayer(container, res); }); container.append(button); } function addPlayer(container, res) { var types = res.map(function(res) { return res.type; }); /* Can we have