如何解析_data到数组?

时间:2017-10-05 12:01:57

标签: aspnetboilerplate

我有这样的API:

fn

我可以通过查看成功调用此API并在Swagger中返回数据:

 public class Calendar : FullAuditedEntity
    {
        public string EventName { get; set; }
        public string Description { get; set; }
        public DateTime StartDate { get; set; }
        public DateTime EndDate { get; set; }
    }

public List<Calendar> GetCalendar()
        {
            var result =  _calendarRepository.GetAll().ToList();
            return new List<Calendar>(result.MapTo<List<Calendar>>());
        }

这是_data的值:

var _$calendarService = abp.services.myproject.calendar;
var _data = _$calendarService.getCalendar();

那么如何将此Object { resolve: Deferred/</e[f[0]](), resolveWith: fireWith(a, c), reject: Deferred/</e[f[0]](), rejectWith: fireWith(a, c), notify: Deferred/</e[f[0]](), notifyWith: fireWith(a, c), state: state(), always: always(), then: then(), promise: promise(a), 4 more… } 解析为要使用的数组(不是jTable)

1 个答案:

答案 0 :(得分:1)

getCalendarjquery.ajax调用,返回jqXHR。

_$calendarService.getCalendar().done(function (data, textStatus, jqXHR) {
    var items = data.items;
    var totalCount = data.totalCount;
    // ...
});