-1

I have below codes:

<pre id="eventoutput">Result Output: ...</pre>      
<script>  // Show Output
 (function (L, document) {


  map.on('measurefinish', function (evt) {
      writeResults(evt);
    });

    function writeResults (results) {
      document.getElementById('eventoutput').innerHTML = JSON.stringify({
        Points: results.points
      }, null, 2);
    }
  })(window.L, window.document);
</script>

And its output is shown as

{
  "Points": [
    {
      "lat": 11.570852645045665,
      "lng": 104.79034423828126
    },
    {
      "lat": 11.61121119698555,
      "lng": 104.85076904296876
    },
    {
      "lat": 11.566816469367417,
      "lng": 104.88235473632814
    }
  ]
}

But I want to format it as a table with Column name Points, Lat, Lng and Row representing each data.

Could you please help me how I can accomplish this.

1
  • since you have the array, you just need to iterate, and for each element create a table row. Commented Dec 29, 2016 at 9:55

1 Answer 1

0

You have to iterate through the array and render the table.

Please have a look at this

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.