2016-07-26 37 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必须从服务器,而不是从本地文件系统中执行它。这很简单。

相关问题