2016-07-26 66 views
0

我正在嘗試遵循教程並在我的Trello板列表中創建新卡。Trello API發佈新卡錯誤 - 未能在'DOMWindow'上執行'postMessage'

我從這裏https://trello.com/app-key 得到我的鑰匙在此之後教程https://developers.trello.com/get-started/start-building 我有我的主板在單獨標籤中打開。並嘗試了公共和私人模式。

但是,我得到

無法執行「的postMessage」上「DOMWindow」:提供的目標來源 (「文件://」)不匹配收件人窗口的原點 ('空「)。

可能是什麼問題?

這是我的代碼:

<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script> 

    <script src="https://api.trello.com/1/client.js?key=MyKey"></script> 



    <body> 
    <script> 




     var authenticationSuccess = function() { console.log('Successful authentication'); }; 
     var authenticationFailure = function() { console.log('Failed authentication'); }; 


Trello.authorize({ 
    type: 'popup', 
    name: 'Getting Started Application', 
    scope: { 
    read: true, 
    write: true }, 
    expiration: 'never', 
    success: authenticationSuccess, 
    error: authenticationFailure 
}); 

    var myList = 'Mylist'; 
    var creationSuccess = function(data) { 
    console.log('Card created successfully. Data returned:' + JSON.stringify(data)); 
}; 

    var newCard = { 
    name: 'New Test Card', 
    desc: 'This is the description of our new card.', 
    // Place this card at the top of our list 
    idList: myList, 
    pos: 'top' 
}; 

Trello.post('/cards/', newCard, creationSuccess); 

    </script> 

回答

0

我想出problem.You必須從服務器,而不是從本地文件系統中執行它。這很簡單。

相關問題