试题详情
单项选择题 A Web service returns a list of system users in the following format. You need to populate a drop-down menu with the IDs and names of the users from the Web service, in the order provided by the service. Which code segment should you use?() 

A、$.ajax({type: "GET", url: serviceURL, success: function(xml) { $.each($(xml), function(i, item) { $("").attr("value", id).text(tx).appendTo("#dropdown"); }); } });

B、$.ajax({ type: "GET", url: serviceURL, success: function(xml) { $(xml).find("user").each(function() { var id = $(this).id;  var tx = $(this).name.text $("").attr("value", id).text(tx).appendTo("#dropdown"); }); } });

C、$.ajax({ type: "GET", url: serviceURL, success: function(xml) { $(xml).find("user").each(function() { var id = $(this).attr("id"); var tx = $(this).find("name").text();$("").attr("value", id).text(tx).appendTo("#dropdown"); }); } });

D、 $.ajax({ type: "GET", url: serviceURL, success: function(xml) {  xml.find("user").each(function(node) {  var id = $(node).attr("id"); var tx = $(node).find("name").text(); $("").attr("value", id).text(tx).appendTo("#dropdown"); }); } });

  • C
  • 关注下方微信公众号,在线模考后查看

热门试题