mercredi 31 mars 2021

How to Display Api Data in HTML?

<script>
     function fetchdata() {
     $.get("http://10.10.35.138:5000/data", function (data) { //The link of this line is my api link
                $("#visitor").html('Visitor Count : ' + data.people);
                $("#time").html('Time : ' + data.time);
            });
        }
</script>

****HTML PART****
<div class="details">
<p id="visitor">Person Count:</p>
<p id="time">Time:</p>`enter code here`
</div>

My Api data is consist of 2 things count and time. I have mentioned two paragraphs above: I want to display count in first paragraph tag. And I want to display Time is another paragraph. I try more time but API data will not appear paragraph tags. Plz help me




Aucun commentaire:

Enregistrer un commentaire