Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <body>
- <div id="id01"></div>
- <script>
- var xmlhttp = new XMLHttpRequest();
- var url = "https://api.coinmarketcap.com/v1/ticker/";
- xmlhttp.onreadystatechange = function() {
- if (this.readyState == 4 && this.status == 200) {
- var myArr = JSON.parse(this.responseText);
- myFunction(myArr);
- }
- };
- xmlhttp.open("GET", url, true);
- xmlhttp.send();
- var out = "";
- out+='<table>';
- function myFunction(arr) {
- // var out = "";
- var i;
- for(i = 0; i < arr.length; i++) {
- // out += '<a href="' + arr[i].url + '">' +
- // arr[i].display + '</a><br>';
- out+='<tr> <td>'+arr[i].id+'</td> <td>'+arr[i].symbol+'</td> <td>'+arr[i].price_usd+'</td> </tr>';
- }
- out += '</table>';
- document.getElementById("id01").innerHTML = out;
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement