I have this HTML table on my page and I want to fill it dynamically with data from this JSON URL: http://services.runescape.com/m=itemdb_rs/api/catalogue/detail.json?item=1055
I honestly don't know the best way to do this but from what I've found JSON templating seems to be what I should use. I've found "Pure.js" ( http://beebole.com/pure/ ) and "Mustache.js" (https://github.com/janl/mustache.js) that use Javascript to help convert JSON data to HTML. I can't figure out how to load the data from the URL using these, the example are all using a static string. Can I/Should I do this with AJAX, jQuery? The data from the JSON url changes daily.
The places I have in the HTML below with {...} are where I want the data from the url to load into.
I'd appreciate if someone could point me in the right direction on how to do this and hopefully provide me with a code sample to help me get this working.
<div class="item-details">
<div>
<h5>
{item.name}
</h5>
<p>Aaaarrrghhh ... I'm a monster.</p></div>
<h6>Pricing Information:</h6>
<table>
<tbody>
<tr>
<th>Current guide price:</th>
<td>{item.current.price}</td>
</tr>
<tr>
<th>Today's Change:</th>
<td class="{item.today.trend}">{item.today.price}</td>
</tr>
</tbody>
<tr>
<th>30 Day Change:</th>
<td class="{item.day30.trend}">{item.day30.change}</td>
</tr>
<tr>
<th>90 Day Change:</th>
<td class="{item.day30.trend}">{item.day90.change}</td>
</tr>
<tr>
<th>180 Day Change:</th>
<td class="{item.day30.trend}">{item.day180.change}</td>
</tr>
</table>
</div>
</div>