This code retrieves the JSON data from the external source and displays it inside the table, it has total 50 rows of data, now I need to display the 1-10 rows, 11-20 rows .. until 40-50 rows when clicked on the respective row of the table, I've posted the whole jquery as it's a complex question to understand, any help will be apprecieated, thank you!
<table class="table table-hover" id="table" style="width:100%">
<tbody>
<tr>
<th>ID</th>
<th>FirstName</th>
<th>LastName</th>
<th>Username</th>
<th>Avatar</th>
<th>E-mail</th>
<th>Age</th>
<th>gender</th>
<th>maritial status</th>
<th>address</th>
<th>Phone</th>
<th>Website</th>
</tr>
</tbody>
</table>
$(document).ready(function() {
fetch('http://fakeapi.jsonparseronline.com/users')
.then(res => res.json())
.then((out) => {
console.log('Output: ', out);
}).catch(err => console.error(err));
$.getJSON('http://fakeapi.jsonparseronline.com/users',
function(data) {
var udata = '';
$.each(data, function(key, value) {
udata += '<tr>';
udata += '<td>' + value.id + '</td>';
udata += '<td>' + ' ' + value.firstName + '</td>';
udata += '<td>' + ' ' + value.lastName + '</td>';
udata += '<td>' + ' ' + value.username + '</td>';
udata += '<td>' + ' ' + value.avatar + '</td>';
udata += '<td>' + ' ' + value.email + '</td>';
udata += '<td>' + ' ' + value.age + '</td>';
udata += '<td>' + ' ' + value.gender + '</td>';
udata += '<td>' + ' ' + value.maritalStatus + '</td>';
udata += '<td>' + ' ' + value.address + '</td>';
udata += '<td>' + ' ' + value.phone + '</td>';
udata += '<td>' + ' ' + value.website + '</td>';
udata += '</tr>';
});
$('#table').append(udata);
$("#table tbody tr").click(function() {
var $row = $(this).closest("tr");
var $text = $row.find("td").text();
alert($text);
});
});
});