Tell me more ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

After the following code snippet is executed, the card is created but the checklist within this card is not. When creating the checklist, the success function is being called with x=0

Expected result: the newly created card should contain checklist with name "Sub Tasks". Why isn't it working?

  var _newCard;
  var name="card name";
  var desc = "card description";
  var boardId = some valisd board id;
  Trello.post("lists/" + idList + "/cards", {
    name: name,
    desc: desc
  }, function(card){
    alert("Card was created");
    _newCard = card;
  });
  Trello.post("checklists", {
      name: "Sub Tasks",
      idBoard: boardId
  }, function(chklist) {
      for (x in _newCard) {
        //alert(x + " is " + _newCard[x]);
      }
      //alert("Checklist id: " + chklist.id);
      Trello.post("cards/" + _newCard.id + "/checklists", {
        value: chklist.id
      }, function(suc) { for (x in suc) { alert(x + " is " + suc[x]); } }, function(err) { alert("Err: " + err) } )
    })
share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.