Search code examples
html-lists

How to display data from API on web page


I have an API URL http://api.openchargemap.io/v2/poi/?output=json&countrycode=NL&maxresults=10 and I want to display this data in a web page in a list format, but I have no idea where to start. Can I use JS? Can anyone help?


Solution

  • you can use js but jquery is better and angularjs is the best, i made you an example in jquery

    $(document).ready(function(){
      $.ajax({
        type:"get",
        url:"http://api.openchargemap.io/v2/poi/?output=json&countrycode=NL&maxresults=10",
        success: function(data){
        result="";
        for(i in data){
        result+="ID: "+data[i].ID+" // UUID: "+data[i].UUID+"<br>";
        }
        $("#list").html(result);
        }
      });
    });
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <div id="list">
    
    </div>