if (data.ReplaceDataFields != null) {
$.each(data.ReplaceDataFields, function (i, item) {
$("<option></option>")
.val(item.ItemKey)
.text(item.ItemValue + "(" + item.ItemKey + ")")
.attr("Id", item.ItemKey)
.appendTo($("#selDataFields"));
});
}
效果如下:
<option value="hotelName" id="hotelName">酒店名称(hotelName)</option>
<option value="rooms" id="rooms">预订数量(rooms)</option>
...........
...........