items 是我在下面的函数中使用的变量... items 值是
[{"daLevel":"DA0","daName":"Da Name 0"},{"daLevel":"DA1","daName":"Da Name 1"},{"daLevel":"DA2","daName":"Da Name 2"},{"daLevel":"DA3","daName":"Da Name 3"},{"daLevel":"DA4","daName":"Da Name 4"},{"daLevel":"DA5","daName":"Da Name 5"},{"daLevel":"DA6","daName":"Da Name 6"},{"daLevel":"DA7","daName":"Da Name 7"},{"daLevel":"DA8","daName":"Da Name 8"},{"daLevel":"DA9","daName":"Da Name 9"},{"daLevel":"DA10","daName":"Da Name 10"}]
我需要在选择框中显示 daName 值作为下拉列表。我无法从 items var 中获取 daName 值。任何建议都会对 gr8 有所帮助。提前致谢
function notifyDa(excessId) {
alert("notified");
var html = "<table><tr><td align='center' colspan='2'> Excess Notification </td></tr><tr><td>Select DA Holder</td><td><select id='daList'>";
var ctx = '${contextPath}';
var queryUrl = ctx + "/excessList.htm?getDaList=true";
$.ajax({
url : queryUrl,
type : "POST",
dataType : "text",
success : function(result) {
alert(result);
**var items = result;
alert("items *** "+items);
alert("items[0] *** "+items.daName[0]);**
$('#notifyDiv').empty();
$('#notifyDiv').html(html);
$("#pop").click(function() {
$("#notifyDiv").fadeIn(1000);
if (!$("#notifyDiv").is(':visible')) {
return;
}
});
$("#notifyDiv").css({
left : ($(window).width() - $('#notifyDiv').width()) / 2,
top : ($(window).width() - $('#notifyDiv').width()) / 7,
position : 'absolute'
});
},
error : function() {
}
});
}