我正在尝试获取卡片评论,然后放入一些html标签。
我确实得到了(我猜)这样做:
Trello.get(“cards / 6a7c530bce987f166f2272ef / actions”,function(err,card){
执行console.log(卡); …
您发送的屏幕截图显示请求返回一组注释卡。如果要显示所有注释,可以使用以下代码:
Trello.get("cards/6a7c530bce987f166f2272ef/actions", function(err, comments) { var html = ""; comments.forEach(function(comment) { html += comment.data.text+"<br>"; } $('#comments').html(html); });
如果您只想要数组中的第一条注释,则可以执行以下操作:
Trello.get("cards/6a7c530bce987f166f2272ef/actions", function(err, comments) { $('#comments').html(comments[0].data.text); });
我建议读一读 使用对象 和 数组 。