Posting array of objects with MVC Web API

前端 未结 3 538
没有蜡笔的小新
没有蜡笔的小新 2020-12-02 15:44

I have a basic post operation that works on a single object of RecordIem. What I would like to do is do the same action but in bulk by posting an array of reque

3条回答
  •  [愿得一人]
    2020-12-02 16:22

    For all that just get an empty array whatever they try, try this:

    var request = $.ajax({
      dataType: "json",
      url: "/api/users",
      method: "POST",
      data: { '': postData}
    });
    

    The data must be a single anonymous object instead of a raw array.

    Info was found here.

提交回复
热议问题