I have one service which gives me lots of Data from back-end. I have to show that in a table using jquery. I shows every data but unable to show the materialDetails in a selectbox. Could anyone help me on this?
$.each(response.data[0].listRawItemDetails, function (i) {
$("#received_item > tbody").append("<tr>" +
"<td>" + '<input type="hidden" name="fabricId'+i+'" value="'+response.data[0].listRawItemDetails[i].fabricId+'">'+ response.data[0].listRawItemDetails[i].fabriceCode + "</td>" +
"<td>" + '<input type="hidden" name="measurementRange'+i+'" value="'+response.data[0].listRawItemDetails[i].measurementRange+'">'+ response.data[0].listRawItemDetails[i].measurementRange + ' ' +response.data[0].listRawItemDetails[i].measurementType+ "</td>" +
"<td>" + '<input type="text" name="rate_'+i+'" id="rate_'+i+'" class="form-control rateCheck" value="" placeholder="Per '+response.data[0].listRawItemDetails[i].measurementType+'" style="width: 100px;" required="required">'+"</td>" +
"<td>" + '<span class="totalAmt'+i+'"></span>' + "</td>" +
**"<td>" + '<select class="form-control" id="materialDetails'+i+'"><option value="">-Select-</option></select>' + "</td>" +**
"</tr>");
}) //foreach
From response.data[0].listRawItemDetails[i].meterials I'm getting list of materials, I need to show that data, in last table data as a selectbox for each row.
I added these lines of code it works for me..
$.each(response.data[0].listRawItemDetails, function (i) {
$.each(response.data[0].listRawItemDetails[0].meterials, function(index, value) {
$('#materialDetails'+i).append('<option value="' + value+ '">' + value+ '</option>');
});
}); //foreach
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.