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);
});
});
精彩评论