.net mvc接收对象数组 通过ajax提交

ajax代码

var obj = {};
        obj.RoomName = "";
        obj.RoomCode = "";

$.ajax({
            type: "POST",
            url: url,
            data: JSON.stringify(obj),
            //contentType是关键,设置后,以json字符串的形式提交数据即可
            contentType: 'application/json',
            dataType: "json",
            success: function (result) {
                
            },
            error: function (data) {
                console.info("请求错误,请检查您的请求!");
            }
        });

  

后台代码

public string UpdateSchedulingInfo(List<SchedulingInfo> dataList, List<long> userList)
        {
            RequestWhere request = CreateRequestWhere();

            ResponseResult<string> response = new ResponseResult<string>();

            return ToJson(response);
        }

  

猜你喜欢

转载自www.cnblogs.com/zhoushangwu/p/10242967.html