You say you are using jQuery but the signate for the success callback of an ajax operation is:
success(data, textStatus, jqXHR)
If you were returning a list of object the the data parameter would typically be an array assuming a json structure of something like:
[{id:1},{id:2},{id:3}]
You'd handle it like you would any other array, a for loop (or forEach or jQuery.each)
for(var i = 0; i<data.Length;i++){
var id = data[i].id;
//do something else
}
As I don't know how your html structure would function with your list of items i'm not sure how to advise specifically how to handle the array contents. Are you wanting to display a list of links?
-- Sam Critchley
"Wise man say 'forgiveness is divine, but never pay full price for late pizza." - TMNT
worldspawn[]
Contributor
6081 Points
1336 Posts
Re: Parse Returned Generic List of Objects in JQUERY
Apr 24, 2012 03:50 PM|LINK
You say you are using jQuery but the signate for the success callback of an ajax operation is:
success(data, textStatus, jqXHR)
If you were returning a list of object the the data parameter would typically be an array assuming a json structure of something like:
[{id:1},{id:2},{id:3}]
You'd handle it like you would any other array, a for loop (or forEach or jQuery.each)
for(var i = 0; i<data.Length;i++){
var id = data[i].id;
//do something else
}
As I don't know how your html structure would function with your list of items i'm not sure how to advise specifically how to handle the array contents. Are you wanting to display a list of links?
"Wise man say 'forgiveness is divine, but never pay full price for late pizza." - TMNT
software development