“ message”:“给定的id不能为空!;嵌套异常为java.lang.IllegalArgumentException:给定的id不能为空!”,“代码”:500

时间:2019-02-01 03:32:00

标签: jquery ajax postman

我有模态,存在模态内的形式,填写字段后,我试图安慰的数据。

我可以看到所有数据都是正确的。但问题是,在插入

这是我的代码在数据的插入:

    let data = {
      "blockDates": blockdates,
      "location": location,
      "photos": cardphotos,
      "videos": cardvideos,
      "unit": unit,
      "title": title,
      "catalogId": catalogId,
      "categoryId": categoryId,
      "subcategoryId": subcategoryId,
      "countryId": countryId,
      "provinceId": provinceId,
      "localityIds": localityIds,
      "contentOptions": contentOptions,
      "themeIds": themeIds,
      "why": why,
      "description": description,
      "cancellationPolicy": cancellationPolicy,
      "displayPrice": displayPrice,
      "displayDiscounted": displayDiscounted,
      "displayMaxPax": displayMaxPax
    };

    console.log(data);

    let content = ajax("api/unitContents", JSON.stringify(data), "POST");
    //insert
    // let contentId = null;
    content = content.done(e => {
      console.log(content);
    }).fail(e => {
      console.log(content);
    });

这是我的API全球AJAX功能

  ajax = (action, data, method) => {
return $.ajax({
  type: method,
  url: `myAPI/${action}`,
  contentType: 'application/json',
  beforeSend: function (xhr) {
    xhr.setRequestHeader("Authorization", `Bearer ${gon.global.currentUser.access_token}`);
  },
  data: data,
  async: !1,
  cache: false,
  error: function (e) {
    console.log(e.responseText);
    console.log("Error occured");
  }
});};

该错误的可能原因是什么?

0 个答案:

没有答案