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: +$("name") }, 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?
resultListis an array of JSON objects, it will / can contain more than one JSON object. So attemptingresultList.ageis never going to work--you need to access a specific index withinresultListbefore grabbing itsageattribute. See the answer from Aziz for more.