异步Web Api调用成功函数未返回数据集

时间:2018-07-02 09:22:05

标签: javascript ajax asp.net-mvc asp.net-web-api

我的异步Web API返回数据

  [HttpGet]
  [Route("PrjID_SelectMob")]
  public async Task<List<PrjID_SelectMob>> PrjID_SelectMob(int CKy, int UsrKy, int ObjKy, int TrnTypKy, int PreKy, string EnvironmentName)
  {
        List<PrjID_SelectMob> objMasList = await accMasService.PrjID_SelectMob(CKy, UsrKy, ObjKy, TrnTypKy, PreKy, EnvironmentName);
        return objMasList;
  }

ajax成功函数未获取我将获得的返回数据(数据集=未定义)

   $.ajax({
    url: "http://localhost:49558/api/ComboLoad/PrjID_SelectMob?CKy=" + Cky + "&UsrKy=" + userky + "&ObjKy=" + ObjKy + "&TrnTypKy=" + FormGlblData.TrnTypKy + "&PreKy=" + 1 + "&EnvironmentName=" + Envermentname,
    type:'GET',
    crossDomain: true,
    dataType: 'jsonp',
    async: false,
    contentType: 'application/json; charset=utf-8',
    success: function (dataSource) {
        dataset = dataSource;
    },
    error: function (XMLHttpRequest, textStatus, errorThrown) {
        console.log(textStatus);
        alert("Status: " + textStatus);
        alert("Error: " + errorThrown);
    }

});

我会收到此错误

Status: parsererror

错误:错误:jQuery112303621583680685383_1530522960313没有被调用

如何将数据集绑定到成功函数中

0 个答案:

没有答案