I am developing application in asp.net MVC My Script is :
$(document).ready
(
function() {
var officerid = document.getElementById('officerid').value;
url = "/TasksToOfficer/Calender/" + officerid;
var data= function()
{
$.ajax(
{
type: 'GET',
url: url ,
dataType: 'json',
data: {'start' : start,'end' : end}
});
};
});
I am unable to get data from my controller action :
[HttpGet]
[AcceptVerbs(HttpVerbs.Get)]
public JsonResult Calender(Guid id)
{
List<TasksToOfficer> officersTasks = null;
IList<CalendarDTO> tasksList = new List<CalendarDTO>();
List<TasksToOfficer> officersTasksRecived = null;
if (String.Compare(Convert.ToString(Session["Role"]), RolesEnum.Admin.ToString())!=0)
{
officersTasksRecived = tasks_to_officer_management.GetTasksToOfficers(id);
foreach (TasksToOfficer tt in officersTasksRecived)
{
DateTime dt = Convert.ToDateTime(tt.Date);
tasksList.Add(new CalendarDTO
{
id=tt.Id,
title =tt.Description,
start = ToUnixTimespan(dt),
end = ToUnixTimespan(dt),
url =""}
);
}
}
else
if (String.Compare(Convert.ToString(Session["Role"]), RolesEnum.Officer.ToString()) != 0)
{
officersTasksRecived = tasks_to_officer_management.GetTasksToOfficers(id);
foreach (TasksToOfficer tt in officersTasksRecived)
{
DateTime dt = Convert.ToDateTime(tt.Date);
tasksList.Add(new CalendarDTO
{
id = tt.Id,
title = tt.Description,
start = ToUnixTimespan(dt),
end = ToUnixTimespan(dt),
url = ""
}
);
}
}
JsonResult resultToView = Json(tasksList);
return Json(resultToView,JsonRequestBehavior.AllowGet);
}
What should be the error ? In fact I am trying to attache the events on full calender control. I am picking up the records and building the JSon data in my action. but unable to show it on my calender. what I have to do ?