Simple jquery plugin for converting json to html
html, javascript, jquery, json, php
Solution
Hi you can use jPut jQuery Plugin (http://plugins.jquery.com/jput/)
Create a HTML jPut Template
<div jput="template">
<a href="{{link}}">{{website}}</a>
</div>
<div id="main">
</div>
<script>
$(document).ready(function(){
var json=[{"website":"google","link":"http://google.com"},
{"website":"facebook","link":"http://fb.com"}];
$('#main').jPut({
jsonData:json, //your json data
name:'template' //jPut template name
});
});
</script>
Problem
I need to append this json data to an html element. ``` [ { "website":"google", "link":"http://google.com" }, { "website":"facebook", "link":"http://fb.com" } ] ``` How to convert this easily using any plugin.Presently,I couldn't find any simple plugins in jquery,So please help me friends. Thanks in advance..........