开发者

How to get the JSON array from server to Jquery mobile application

I have a REST based webservice which returns json array like [{"name":"abc","age":"24","gender":"female"}]. I used this webservice from my Jquery Mobile application like

$.getJSON("http://localhost:8080/webservice/name", { name: +$("na开发者_如何转开发me") }, function(resultList){
    alert("JSON Data: " + resultList.age);
  }); 

But I am getting "undefined" in my alert box. How to return the JSON Array from webservice. What could be the issue here?


Please try this and see if it works:

$.getJSON("http://localhost:8080/webservice/name", { name: +$("name") }, function(resultList){
     $.each(resultList, function(key, val) {
          alert("JSON Data: key" + key + " value: " + value);
     });
}); 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜