Ajax request returns bad request error code

Solution
let request = $.ajax({
      url: url,
      type: 'POST',
      data: JSON.stringify(data_dict),
      contentType: 'application/json;charset=UTF-8',
    });