What is the best way to generate html code after receiving json data from an ajax request using a template library?
<p>I am doing something like this, but its a bit pain to style. Is there any other way like using templates? </p>

<pre><code>   &lt;div id="resultpanel"&gt;&lt;/div&gt;

    &lt;script&gt;
    function parseData(jsonresults){
        var results = JSON.parse(jsonresults);
        jQuery("#resultpanel").empty();

        for(var i=0;i&lt;results.length;i++){
            var divph = document.createElement("div");
            var img = document.createElement("img");
            var p = document.createElement("p");

            img.src=results[i].logoname;
            p.innerHTML=results[i].perigrafh;
            jQuery(divph).append(img);
            jQuery(divph).append(p);            
            jQuery("#resultpanel").append(divph);   

        }       
     }
    &lt;/script&gt;
</code></pre>

<p>Thank you </p>
