Hello prashant,
The listItemsSheet is a JSON Array and in this case contains only a single element. Your loop essentially is going to return the zeroth element which itself is a Json Object. So the loop is going to get called only once, and hence your code fails. The more appropriate way is to re-write this loop as shown below.
$.each(data.obj.lstTimesheet, function (i, obj) {
if (isJSON(obj)) parseMe(obj);
});
function parseMe(data) {
var i = 0;
$.each(obj, function(k, val) {
if (/^Day/.test(k) {
var txtID = 'txtTime' + k.substring(;
$('#Grid tbody tr').eq(i).each(function () {
$(this).find('td').eq(1).find(txtID).append(val);
});
i++;
}
});
});
function isJSON(data) {
var isJson = false
try {
var json = JSON.stringify(data);
isJson = (json != null);
} catch (ex) {
console.error('data is not JSON');
}
return isJson;
}
Please have a look at a sample demo
here[
^].
Regards,