I got an Json object by using jQuery's getjson() method like that:
<script>
$(document).ready(function(){
$("button").click(function(){
$.getJSON(the_api_url, {}, function(data) {
// do something
});
});
});
});
</script>
The data is an array list, and its format is like this:
[
{
id : "001",
name : "apple",
class : "fruit",
colour : "red"
},
{
id : "002",
name : "melon",
class : "fruit",
colour : "green"
},
{
id : "003",
name : "banana",
class : "fruit",
colour : "yellow"
}
]
I am new to JavaScript and don't know how to parse and display it in html page. Could you guys help me with the code in the '//do something' part?
html(),append()etc});in your code