如何从addCard trello API创建trello卡后捕获该卡的链接
How to capture link of a trello card after creating it from addCard trello API?
我正在用JS函数在trello板中创建一张新卡
var currentLocation = window.location.href;
function AddCardToTrello() {
Trello.addCard({
url: currentLocation,
name: "{{ soproduct.product }}",
due: {{ soproduct.required_date|date:"SHORT_DATE_FORMAT" }}
});
}
创建后,我得到了一个Trello向导,它会向我显示Trello板上新创建的卡的链接。我想捕捉这个链接并将其保存在我的背上。我该怎么做?是否可以从相同的API调用中捕获数据?
我刚刚在Trello Sandbox上测试了这个:
var destinationList = "XX_YOUR_LIST_ID_XX";
var success = function(successMsg) {
asyncOutput(successMsg);
};
var error = function(errorMsg) {
asyncOutput(errorMsg);
};
var newCard =
{name: "I just created a new card!",
desc: "Using the Trello API is fun and easy!",
pos: "top",
due: null,
idList: destinationList
};
Trello.post('/cards/', newCard, success, error);
successMsg
回调值在对象中包含一个参数:
"url": "https://trello.com/c/PCJcEkmm/6-i-just-created-a-new-card"
因此,我的建议是将保存到后端的过程添加到您的成功函数中——这取决于您使用的插件/脚本架构。
var success = function(successMsg) {
console.log(successMsg);
//Save to storage here
};
var error = function(errorMsg) {
console.log(errorMsg);
};
function AddCardToTrello() {
Trello.addCard({
url: currentLocation,
name: "{{ soproduct.product }}",
due: {{ soproduct.required_date|date:"SHORT_DATE_FORMAT" }}
}, success, error);
}
相关文章:
- 创建一个类似链接的按钮,并通过Javascript函数打开一个新的弹出窗口
- 如何使用jQuery自动打开页面上的所有链接
- 动态地改变“”的URL;添加新项目”;链接使用javascript/jquery
- jquery动画可以通过编程链接吗
- 在单击href链接的同时下载文件
- 尽管链接成功并已成功下载,但未找到NPM模块
- 制作一个不带HTML a标记但在动画播放完毕后指向其他页面的超链接
- ReactJS映射:如何仅在url变量不为空时呈现html链接
- 单击页面上的链接后高度发生变化
- 将纯文本URL转换为可单击链接
- python-selenium-点击上升链接
- 一点javascript元编程&可链接的设置器
- ng视图外的链接重定向到ng视图内的页面
- 如何调用“;链接_;在onclick事件上使用Javascript
- 链接所有<a>Meteor
- 如何在Angular中的表的所有单元格中添加链接
- 通过链接重定向不;我不在jstree中工作
- 根据选项卡内部的文本链接中的哈希ID动态选择jqueryUI选项卡
- 用JavaScript Trello API链接承诺
- 如何从addCard trello API创建trello卡后捕获该卡的链接