Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/439.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 Trello API发布新卡错误-无法执行';后消息';在';DOMWindow';_Javascript_Api_Dom_Postmessage_Trello - Fatal编程技术网

Javascript Trello API发布新卡错误-无法执行';后消息';在';DOMWindow';

Javascript Trello API发布新卡错误-无法执行';后消息';在';DOMWindow';,javascript,api,dom,postmessage,trello,Javascript,Api,Dom,Postmessage,Trello,我正试图遵循一个教程,在我的Trello板列表中创建一张新卡 我从这里拿到钥匙 遵循本教程 我有我的董事会在单独的标签打开。并尝试了公共和私人模式 然而,我越来越 无法在“DOMWindow”:目标源上执行“postMessage” 提供的('file://')与收件人窗口的来源不匹配 ('null') 有什么问题吗 这是我的代码: var authenticationSuccess=function(){console.log('Successful authentication');};

我正试图遵循一个教程,在我的Trello板列表中创建一张新卡

我从这里拿到钥匙 遵循本教程 我有我的董事会在单独的标签打开。并尝试了公共和私人模式

然而,我越来越

无法在“DOMWindow”:目标源上执行“postMessage” 提供的('file://')与收件人窗口的来源不匹配 ('null')

有什么问题吗

这是我的代码:


var authenticationSuccess=function(){console.log('Successful authentication');};
var authenticationFailure=function(){console.log('Failed authentication');};
特雷罗({
键入:“弹出窗口”,
名称:“入门应用程序”,
范围:{
读:没错,
写:真的},
到期日:“永不”,
成功:authenticationSuccess,
错误:身份验证失败
});
var myList='myList';
var creationSuccess=函数(数据){
log('已成功创建卡。返回数据:'+JSON.stringify(数据));
};
var新卡={
名称:“新测试卡”,
描述:“这是我们新卡的描述。”,
//把这张卡片放在我们名单的最上面
懒惰者:myList,
位置:“顶部”
};
Trello.post(“/cards/”,newCard,creationSuccess);

我解决了问题。您必须从服务器而不是本地文件系统执行它。就这么简单

  <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>