我有一个基于REST的webservice,它返回像[{"name":"abc","age":"24","gender":"female"}]
这样的json数组。我在我的Jquery Mobile应用程序中使用了这个used服务,如下所示
$.getJSON("http://localhost:8080/webservice/name", { name: +$("name") }, function(resultList){
alert("JSON Data: " + resultList.age);
});
但我在我的警告框中变得“未定义”。如何从webservice返回JSON数组。这里的问题可能是什么?
发布于 2011-07-08 20:05:45
请尝试一下,看看它是否有效:
$.getJSON("http://localhost:8080/webservice/name", { name: +$("name") }, function(resultList){
$.each(resultList, function(key, val) {
alert("JSON Data: key" + key + " value: " + value);
});
});
https://stackoverflow.com/questions/6623689
复制相似问题