我得到这样的答复:
Array
(
[0] => stdClass Object
(
[id_c] => 7556b3a6-768a-5578-6ebc-5b8a8f758200
[symptom_c] => Leakage
[symptom_code_c] => SYM11150
[defect_c] => ELBOW 3/8 *3/8 PUSHFIT
[defect_code_c] => LEE88PF2
[repair_c] => LEE88PF101
[repair_code_c] => PRTFNTAPE2
[type_c] => Replaceable
)
[1] => stdClass Object
(
[id_c] => 7ed651a2-77d3-6f82-edb5-5b8cc49a3fed
[symptom_c] => Leakage Fault
[symptom_code_c] => SYM11150
[defect_c] => ELBOW 3/8 *3/8 PUSHFIT
[defect_code_c] => LEE88PF24575
[repair_c] => LEE88PF102
[repair_code_c] => PRTFNTAPE1245
[type_c] => Replaceable
)
)
如何在选择下拉列表中填充?
答案 0 :(得分:1)
尝试一下。对于响应数组的每个对象,在选择的末尾添加一个选项。未经测试,但应该可以工作
$.ajax(
// your ajax
).done(function(data)
{
$.each(function(data, index, object)
{
$('#yourSelectId').append("<option>" + object.id_c + "</option>");
}
});