Trying my way on a little bit of JSON here in my asp.net mvc project. I have the following View:
<asp:Content ID="Content3" ContentPlaceHolderID="NavigationPlaceholder" runat="server">
<script type="text/javascript">
$(document).ready(function () {
alert('loaded');
$.getJSON('/Students/LoadYearRoot', null, function (data, textStatus) {
alert('test');
});
});
</script>
</asp:Content>
and the following controller (Please note that i commented out my database call and is just trying with strings.:
public JsonResult LoadYearRoot()
{
GWSSchool school = SchoolHelper.GetSchool();
//List<GWSYear> years = yearRepository.GetAll(school.Id);
List<string> strings = new List<string>() { "first", "second", "third" };
JsonResult result = this.Json(strings);
return result;
}
Observing the view i get my first alert, showing "loaded", but then it stops, and i never get into the callback function, i tested that i hit the controller using a breakpoint, so the result seems right.
Any ideas, all examples i found on the web is exactly like this, what am i missing?