i want to receive the value thought itterator, when i use $('#someModal').find('input[name=nameProBangHHModal]').val(data[0].TenNhanQuyCach); -- it work as expected but when i use iterator the return show ([object Object].TenNhanQuyCach) not the data return. i try to seach for other topic but stuck in this. So how to get the data return in array[data[0]] with the value from the iterator method. Thank you for your time!
$.ajax({
url: 'someurl to retrive data',
type: 'POST',
data: {id:id},
success: function(data,status) {
var tenCot = ['nameProBangHHModal','valueBangHHModal',];
var tenCotTrongCsdl = ['TenNhanQuyCach','DonViTinh',];
console.log(tenCotTrongCsdl[0]);
for (i=0;i <= tenCot.length - 1;i++) {
$('#someModal').find('input[name="' + tenCot[i] + '"]').val(data[0]+'.'+tenCotTrongCsdl[i]');
}