Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 从addCard trello API创建trello卡后,如何捕获该卡的链接?_Javascript_Api_Trello - Fatal编程技术网

Javascript 从addCard trello API创建trello卡后,如何捕获该卡的链接?

Javascript 从addCard trello API创建trello卡后,如何捕获该卡的链接?,javascript,api,trello,Javascript,Api,Trello,我正在用JS函数在trello板上创建一张新卡 var currentLocation = window.location.href; function AddCardToTrello() { Trello.addCard({ url: currentLocation, name: "{{ soproduct.product }}", due: {{ soproduct.required_date|date:"SHORT_DATE_FORMAT" }} }); } 创建完成

我正在用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沙盒上测试了这个:

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);
successsg
回调值在对象中包含一个参数:

“url”:https://trello.com/c/PCJcEkmm/6-i-just-created-a-new-card“

因此,我的建议是将保存到后端的过程添加到success函数中,具体取决于所使用的插件/脚本体系结构

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);
}

我刚刚在Trello沙箱上测试了这个:

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);
successsg
回调值在对象中包含一个参数:

“url”:https://trello.com/c/PCJcEkmm/6-i-just-created-a-new-card“

因此,我的建议是将保存到后端的过程添加到success函数中,具体取决于所使用的插件/脚本体系结构

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);
}

您是否使用npm包作为中介?什么样的?不是建议您应该这样做,但是代码与API文档中的示例不同。不,我不是。它的后端是纯django,而JSM是您使用npm包作为中介的吗?什么样的?不是建议您应该这样做,但是代码与API文档中的示例不同。不,我不是。它是纯django作为后端,谢谢,这是我正在寻找的。然而,当我尝试调试时,我在控制台中看不到任何东西。它假设我也不能从那里阅读。谢谢你,这就是我要找的。然而,当我尝试调试时,我在控制台中看不到任何东西。它假定我也不能从那里阅读。