服务器端:
[RestService("/x")]
public class XFilter
{
public long[] CountryIds { get; set; }
}
public class XService : RestServiceBase<XFilter>
{
private const int PageCount = 20;
public override object OnGet(XFilter request)
{
Debugger.Break(); // request is always default at this point !!
return a;
}
}
客户端:
<script type="text/javascript">
var requestData= "{CountryIds:[1,2]}";
$.getJSON("/api/x", requestData, function (b) {
});
它一定很简单,但我无法使用这种方法在服务器端获取 XFilter。