I am getting the data from the below url
and I want to display a html table on my page, something like the image below HTML Table
Can anyone help me to get the desired table with the help of javascript or php.
UPDATED: Below is the code I am trying, not sure
<script>
var url = "https://www.cmegroup.com/CmeWS/mvc/Margins/OUTRIGHT?1=1&sortField=exchange&sortAsc=true&exchange=NYM§or=DME+Products&pageSize=500&pageNumber=1&_=1537972316703";
// send AJAX request
var req = new XMLHttpRequest();
req.onload = function() {
generateHTMLTable(req.response);
}
req.open("GET",url);
req.send();
// generate HTML string and insert it
function generateHTMLTable(data) {
var str = "";
for(var row=0; row<data.length; row++) {
str += "<tr>"; // open HTML row
for(var col=0; col<data[row].length; col++)
str += "<td>" + data[row][col].name + "</td>";
str += "</tr>"; // close HTML row
}
// assumes the table element has id "table":
// <table id="table"></table>
var table = document.getElementById("table");
table.innerHTML = str;
}
</script>