Start a new topic

Wrong data format

When trying to do the "First Poll Indicator App" tutorial I get the error "Wrong data format" when using the Dropbox direct link. What possibly can I be doing wrong?


http://lametric-documentation.readthedocs.io/en/latest/guides/first-steps/first-lametric-indicator-app.html#poll-indicator-app






1 person has this question

Having the same problem here ...

My code outputs the json string but the cotype is html... still get wrong data format.


 

<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>Demo</title>
</head>
<body>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
    <script>

    //Get the status
    $.getJSON('https://api.mcsrvstat.us/1/SERVERIP', function(status) {

      	//Show a list of players
      	$.each(status.players.list, function(index, player){
          var data = {
              "frames": [
                  {
                      "text": "Server",
                      "icon": "i16865"
                  },
                  {
                      "text": player,
                      "icon": null
                  }
              ]
          }

//Print status to body
  document.getElementById("json").innerHTML = JSON.stringify(data, undefined, 2);
        });
        });
</script>
<pre id="json"></pre>
</body>
</html>

 the output being :


 

{
  "frames": [
    {
      "text": "Server",
      "icon": "i16865"
    },
    {
      "text": "Gamer123",
      "icon": null
    }
  ]
}

 But it does not work. This implies the file HAS to be a json.

Login or Signup to post a comment