$(document).ready(function() {
$.ajax({
type: "GET",
url: "accounts.php",
data: { action: 'start' },
success: function(response){
var allRows = JSON.parse(response);
$.each(allRows, function(rowIndex, row) {
var tr = $(document.createElement('tr'));
$.each(row, function(index, value) {
if (index == 'id' || index == 'description') return true;
tr.append('<td>'+value+'</td>');
});
tr.appendTo($('tbody'))
});
}
});
$(document).on( 'click', 'tbody tr td:first-child', function() {
var num = $(this).text();
var td = $(this);
$.ajax({
type: "GET",
url: "accounts.php",
data: { number: num },
success: function(response){
$(td).append('<div class="description"><b>Description</b>: '+response+'</div>');
}
});
});
$(document).on( 'click', 'html', function() {
$('.description').remove();
});
});