I am making an ajax call using jquery to get data in json format. the success callback function is called, but the data is empty.
$(document).ready(function () { $.ajax({ url: "http://apps.sungardhe.com/StudentResearch/public/Research.svc/Schools", type: "GET", contentType: "application/json; charset=utf-8", dataType: "json", success: cbSchools }); }); function cbSchools(data) { if (data == null) { alert("data is null"); return; } for (var school in data) { $("#ddSchool").append("<option value='" + data[school].ShortName + "'>" + data[school].ShortName + "</option>"); } }
With fiddler, I can see that the answer actually returns json data, but for some reason the jquery result object is NULL. can anyone tell me why?
source share