How do I display the string message from BadRequest(message) using Ajax

I have my API Controller

public ActionResult<Campaigns> AddCampaign([Bind("Name, Venue, AssignedTo, StartedOn, CompletedOn")] Campaigns campaigns)
    {
        try
        {
            if (ModelState.IsValid)
            {
                if (CampaignNameExists(campaigns.Name))
                {
                    throw new Exception("A campaign with that name already exists!");
                }
                if(!UsersIdExists(campaigns.AssignedTo))
                {
                    throw new Exception("User assigned to this Campaign does not exist!");
                }

                var isAdmin = _accessCheck.AdminCheck(campaigns.AssignedTo);

                //Check if user is Admin
                if(isAdmin.IsAdmin == 1)
                {
                    throw new Exception("Admins cannot be assigned to campaigns");
                }

                //Send User details to Repo for insertion to DB
                if (condition)
                    return result
                else
                    throw new Exception("Could not add campaign");
            }
            else
            {
                throw new Exception("Model State is not valid");
            }
        }
        catch (Exception ex)
        {
            var message = ex.Message;
            return BadRequest(message);
        }
    }

AND my VIEW

    <script>
    $(document).ready(function () {

        $("#createBtn").click(function () {
            let data = {
                "Name": $('#Name').val(),
                "Venue": $('#Venue').val(),
                "AssignedTo": $('#AssignedTo').val(),
                "StartedOn": $('#StartedOn').val(),
                "CompletedOn": $('#CompletedOn').val()                
            };
            $.ajax({
                type: "POST",
                url: "http://localhost:25733/api/Admin/Campaign/Add",
                data: JSON.stringify(data),
                contentType: "application/json",
                success: function () {
                    document.getElementById("campDivSuccess").style.display = 'block'
                },
                error: function (response) {
                    document.getElementById("campDivFail").style.display = 'block'
                    let fail = '<p>'+ response +'</p>'
                    $('#campDivFail').append(fail);
                }
            })
        })
    })
</script>

Which is supposed to add the BadRequest(string) as Paragraph tag in this div

<div class="alert alert-dismissible alert-danger" id="campDivFail" style="display: none">
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
</div>

Which it’s doing but as [object] [Object] and not as the string which I assigned to the BadRequest, like say “Campaign Could not be assigned”. I searched a lot but could not find the solution. Am I using response wrong? Is there another function that does this?

Answer

I found the correct documentation. The content I was looking for in ‘response’ was “responseText”. I just had to use response.responseText in the paragraph. SOURCE: developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest