asp.net FromBody接收不到参数的解决方法
今天改一个前端框架(angularjs,不兼容ie内核,需要修改),后台框架是已经写好了的,不用修改。
接口接收参数如下:
[HttpPost] public async Task<ScheduleEntity> QueryJob([FromBody]JobKey job) { return await scheduler.QueryJobAsync(job.Group, job.Name); }
前端框架因为是angularjs写的封装好了,改成adminlte+vue
前端调用方法如下:
var objBody={ name: that.name, group: that.group }; $.ajax({ type: "Post", url: "/api/Job/QueryJob", data: JSON.stringify(objBody), contentType: "application/json; charset=UTF-8", success: function (data) { that.model = data; }, beforeSend: function () { layer.load(); }, complete: function () { layer.closeAll('loading');} });