I started a demonstration project on HTML, JSON and jQuery recently. Thing I want to achieve now is get data from the JSON file and load it into my table. I am new to JSON so it
With reference to this post
JSON.parse unexpected character error
I come to know that you parse already parsed JSON
You can replace your script as follows:
window.onload = function () {
var contacts;
$.getJSON('contact.json',function(contacts)
{
$(contacts.info).each(function(index, element){
$('#contacts').append('' + element.fullname + ' '
+ element.email + ' '
+ element.phone + ' '
+ element.badgeid + ' ');
})
});
};