I am trying to fill some content with JSON data:
HTML:
- <div id="overview">
- <div class="counter" style="background: lime">
- <h2 class="count-title" data-field="counter1">0</h2>
- </div>
- <div class="counter" style="background: red">
- <h2 class="count-title" data-field="counter2">0</h2>
- </div>
- </div>
JSON:
{ "counter1" : "5","counter2" : "30" }
JS:
- $.getJSON('<json file>', function (data) {
- $('#overview'. ?????
- });
there are up to 20 counters, so the fields should filled in dynamic with json key as data-field and json value as data. In additon, the json data should be reloaded every 5 seconds.