Ajax doing a week. How to build HTML
with jQuery
That is, it is necessary that the script read JSON
, see, for example, item JSON
-a, collect HTML
and insert data from JSON
into the collected DOM
elements that jquery collects when it sees JSON
.
Below is JSON
, which I did, and a little below is the HTML
structure, which should turn out of it.
{ "works-item":{ "item":{ "title":"Limited <br>для VAZ", "image-data":"VAZ", } "item":{ "title":"Limited <br>в BAZ", "image-data":"BAZ", } }
<div id="cases" class="c-works"> <h2 class="work-header" style="display: none;"></h2> <div class="box_skvere"> <img data-url="worksVAZ" src="img/works/VAZ.jpg"> <h3>Limated <br>для VAZ</h3> </div> <div class="box_skvere"> <img data-url="worksBAZ" src="img/works/BAZ.jpg"> <h3>Limited <br>в BAZ</h3> </div> </div>
That is, roughly speaking, initially there is nothing in Html, everything is collected after reading and parsing json-a. And the number of collected house-elements must match the number of elements in json.
Help to understand, please, who knows.