使用POST请求过滤loadData

时间:2018-05-31 07:03:00

标签: javascript jquery web-services xmlhttprequest jsgrid

使用POST请求时,网格未被过滤

loadData: function (filter) {
  return $.ajax({
  type: "POST",
  url: "frmNewGroup.aspx/searchFilter",
  data: JSON.stringify(filter),
  contentType: "application/json; charset=utf-8",
  success: function (data) {
     console.log(data);
    }
  });
}


我们必须使用GET请求吗?

感谢。

1 个答案:

答案 0 :(得分:3)

从ajax获取数据时,您错过了def.resolve(data);

loadData : function(filter) {
        var def = $.Deferred();
        $.ajax({
           type: "POST",
          url: "frmNewGroup.aspx/searchFilter",
          data: JSON.stringify(filter),
          contentType: "application/json; charset=utf-8",
        }).done(function(data) {
            console.log(data);
            def.resolve(data);
        });
        return def.promise();
    }