How to return json result from function?
I am trying to return a Json request, but it is always null. I'm not sure what I am doing wrong...
/* GetTasksByDateRange */
this.fnGetTasksByDateRange = function (dateFilter)开发者_运维问答
{
/* Get tasks by date range */
var oData = {};
var jsonTaskData = $.getJSON('/Planner/Planner/GetTasksByDateRange', { 'dateFilter': dateFilter }, function (jsonTaskData)
{
oData = jsonTaskData;
});
return oData;
}
oData
hasn't been set at that point. You will need to have the asynchronous function call another, passing it the data.
精彩评论