processing JSON output in AJAX
How to process JSON output in AJAX?
Reiterating on the same question asked yday(Above link),I seem to have more clarity now.
I get JSON outpu开发者_运维知识库t in 'data' var query = getDomainURL() + "/ProgramCalendar/GetJSONData";
$.post(query, null, function (data) {...}
Now i Need to loop through the nodes and Identify 'Key' based on the names, and do some action for the 'val'
$.each(data, function(key, val) { ... } Can it be done using something similar with $.each, can you let me know the exact syntax?
Thanks, Adarsh
If the server returns a JSON array you could use $.each
:
$.each(data, function(index, item) {
// item represents the current element of the array
// here you can access its properties like
alert(item.EventText);
});
精彩评论