ページにこの HTML テーブルがあり、この JSON URL からのデータを動的に入力したいと考えています: http://services.runescape.com/m=itemdb_rs/api/catalogue/detail.json?item=1055
正直なところ、これを行う最善の方法はわかりませんが、私が見つけたものから、JSON テンプレートを使用する必要があるようです。Javascript を使用して JSON データを変換する"Pure.js" ( http://beebole.com/pure/ ) と "Mustache.js" (https://github.com/janl/mustache.js) を見つけました。 HTMLに。これらを使用して URL からデータをロードする方法がわかりません。例はすべて静的文字列を使用しています。AJAX、jQueryでこれを行うことができますか/すべきですか? JSON URL からのデータは毎日変化します。
以下の HTML で {...} を使用している場所は、URL からのデータをロードする場所です。
誰かがこれを行う方法について正しい方向に向けてくれれば幸いです。うまくいけば、これを機能させるのに役立つコードサンプルを提供してくれます。
<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>