I'm using $.ajax Get method to get list of JSon objects. My jquery is
$.ajax({
url: 'ItemHandler',
method: 'GET',
dataType: 'json'
},
complete: function(items) {
$.each(items,function(i,object){
alert(object)
}
}
});
And the ItemHandler is like this
public void ProcessRequest(HttpContext context)
{
List<JObject> jsonList = new List<JObject>();
List<Item> items = GetItems();
foreach(Item item in items)
{
//string str = Append properties with values to the string
jsonList.Add(JObject.Parse(str));
}
context.Response.ContentType = "application/json";
context.Response.Write(jsonList);
}
From ItemHandler it adds created Json object to the jsonList correctly and write to the context.response. But within the jquery loop it doesn't give me the object. It shows undefined as in the alert. I need to get each object from there.
success? also try to logitemsbefore iterating.