GET Trello JSON to put in a string var

Posted by Verber on Stack Overflow See other posts from Stack Overflow or by Verber
Published on 2012-09-22T21:23:03Z Indexed on 2012/09/22 21:37 UTC
Read the original article Hit count: 331

Filed under:
|
|

I'm trying to get the JSON that a TRELLO API Url returns and put it into a string. On my own private board I am getting "401 Unauthorized". But the Trello Api doesn't seem to give any way to authorize a user through the URL. If I try a public board I get "XMLHttpRequest cannot load https://api.trello.com/1/board/4d5ea62fd76aa1136000000c?key=68d02bf40d2ad57dd9eb418eb15f9564. Request header field X-Requested-With is not allowed by Access-Control-Allow-Headers."

This is my code:

     <body>
     <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js">  </script>

      <script>

      var list = $.getJSON(" https://api.trello.com/1/board/4d5ea62fd76aa1136000000c? key=68d02bf40d2ad57dd9eb418eb15f9564");
      document.getElementById('print').innerHTML = list;


      </script>
      <div id="print">
      </div>
      </body>

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about JSON