I am trying to readed json file in jquery with javascript. What is my wrong with this code
$(function() {
var new4 = [];
$.getJSON('new4.json', function(data) {
$.each(data.new4, function(i, f) {
var tblRow = "<tr>" + "<td>" + f.FirstName + "</td>" +
"<td>" + f.LastName + "</td>" + "<td>" + f.EmailAddress + "</td>" + "<td>" + f.City + "</td>" + "</tr>"
$(tblRow).appendTo("#userdata tbody");
}
ss);
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<html>
<head>
</head>
<body>
<div class="wrapper">
<div class="profile">
<table id="userdata" border="2">
<thead>
<th>FirstName</th>
<th>LastName</th>
<th>EmailAddress</th>
<th>City</th>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</body>
</html>
And my json codes
{
"person": [
{
"firstName": "Clark",
"lastName": "Kent",
"Email Address": "Reporter",
"City": 20
},
{
"firstName": "Bruce",
"lastName": "Wayne",
"Email Address": "Playboy",
"City": 30
},
{
"firstName": "Peter",
"lastName": "Parker",
"Email Address": "Photographer",
"City": 40
}
]
}
For source, I download a jquery file fromwebsite to my folder.
I added this picture because of source is very important about json and I want to be sure my way is ture for create a html.
