我有以下代码:
$(document)
.ready(
function() {
$.ajax({
type : "GET",
url : "http://localhost:8080/RememberMeServer/rest/LifeEventService/events",
dataType : "xml",
success : function(xml) {
$(xml).find('Event').each(function() {
var name = $(this).find('Text').text();
$('#droplistevents').append($('<option/>', {
value: name,
text : name
}));
});
},
error : function(xhr) {
alert(xhr.responseText);
}
});
});
它的作用是对在该地址上运行的Web服务的get请求,并获取<Event> <Text> </Text> </Event>
但遗憾的是我无法将该信息添加到我的html文件中的选择框中,其中包含id =&#34; droplistevents&#34;。 我做错了什么?
答案 0 :(得分:-1)
这实际上有效。我在调用它的html页面中调用了错误的js。
我不删除,因为这可能有助于某人