I have a JSON file named detail.json and it is like this
{"name":"bhanu","constituency":"vizag","party":"bjp"},
{"name":"nithya","constituency":"godavari","party":"bjp"}
I want to display this as a HTML table ans I've written this
<table id="deets">
<tr>
<th>Name</th>
<th>const</th>
<th>party</th>
</tr>
</table>
<script type="text/javascript">
$(document).ready(function(){
$.getJSON("detail.json",function(data){
var det = '';
$.each(data,function(key,value){
det +='<tr>';
det +='<td>'+value.name+'</td>';
det +='<td>'+value.constituency+'</td>';
det +='<td>'+value.party+'</td>';
det += '</tr>';
});
$('#deets').append(det);
});
});
</script>
But when I open it only the table header is being displayed but the data is not being parsed from the JSON file. What's the mistake in this code and what could be the issue? I've tried it many times.