i am trying to load Fancytree with ajax. Bellow is my code, I am not getting any error while calling the method. Also i have verified that data return back to the ajax method. But unable to load child objects into the tree. can someone help me to identify the exact issue ?
Ajax call:
lazyLoad: function (event, data) {
data.result = $.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
dataType: "json",
url: "frmCSMWorkstation.aspx/GetList",
error: function (xhr, status, error) {
// Display a generic error for now.
alert("AJAX Error!");
}
});
},
Webmethod
[WebMethod]
public static string GetList()
{
try
{
using (var context = new DataEntities())
{
var objGroup = context.ObjectGroups.Select(s => new { title = s.Name.Replace("/", ""), key = s.ObjectGroupUid }).Take(5);
var jsonSerialiser = new JavaScriptSerializer();
var json = jsonSerialiser.Serialize(objGroup);
return json;
}
}
catch (Exception)
{
throw;
}
}
Returned data from Webmethod
[
{"title":"Title1","key":"2c6ac17b-cbb5-e511-8213-00215a9c800e"},
{"title":"Title2","key":"8db871b2-2db6-e511-8213-00215a9c800e"},
{"title":"Title3","key":"e409320e-31b6-e511-8213-00215a9c800e"},
{"title":"Title4","key":"bd7f22b2-31b6-e511-8213-00215a9c800e"}
]