Skip to main content

I can confirm that on asp.net core 2.1, removing the content type made my ajax call work.

function PostData() {
        var answer = [];
        for (let i = 0; i < @questionCount; i++) {
            answer[i] = $(`#FeedbackAnswer${i}`).dxForm("instance").option("formData");
        }
        var answerList = {answers : answer}
        $.ajax({
            type: "POST",
            url: "/FeedbackUserAnswer/SubmitForm",
            data: answerList ,
                dataType: 'json',
                error: function (xhr, status, error) { },
                success: function (response) {
                }
            });
    }

 [HttpPost]
        public IActionResult SubmitForm(List<Feedback_Question> answers)
        {}

function PostData() {
    var answer = [];

    for (let i = 0; i < @questionCount; i++) {
        answer[i] = $(`#FeedbackAnswer${i}`).dxForm("instance").option("formData");
    }

    var answerList = { answers: answer }

    $.ajax({
        type: "POST",
        url: "/FeedbackUserAnswer/SubmitForm",
        data: answerList ,
        dataType: 'json',
        error: function (xhr, status, error) { },
        success: function (response) { }
    });
}
[HttpPost]
public IActionResult SubmitForm(List<Feedback_Question> answers)
{}

I can confirm that on asp.net core 2.1, removing the content type made my ajax call work.

function PostData() {
        var answer = [];
        for (let i = 0; i < @questionCount; i++) {
            answer[i] = $(`#FeedbackAnswer${i}`).dxForm("instance").option("formData");
        }
        var answerList = {answers : answer}
        $.ajax({
            type: "POST",
            url: "/FeedbackUserAnswer/SubmitForm",
            data: answerList ,
                dataType: 'json',
                error: function (xhr, status, error) { },
                success: function (response) {
                }
            });
    }

 [HttpPost]
        public IActionResult SubmitForm(List<Feedback_Question> answers)
        {}

I can confirm that on asp.net core 2.1, removing the content type made my ajax call work.

function PostData() {
    var answer = [];

    for (let i = 0; i < @questionCount; i++) {
        answer[i] = $(`#FeedbackAnswer${i}`).dxForm("instance").option("formData");
    }

    var answerList = { answers: answer }

    $.ajax({
        type: "POST",
        url: "/FeedbackUserAnswer/SubmitForm",
        data: answerList ,
        dataType: 'json',
        error: function (xhr, status, error) { },
        success: function (response) { }
    });
}
[HttpPost]
public IActionResult SubmitForm(List<Feedback_Question> answers)
{}
Source Link

I can confirm that on asp.net core 2.1, removing the content type made my ajax call work.

function PostData() {
        var answer = [];
        for (let i = 0; i < @questionCount; i++) {
            answer[i] = $(`#FeedbackAnswer${i}`).dxForm("instance").option("formData");
        }
        var answerList = {answers : answer}
        $.ajax({
            type: "POST",
            url: "/FeedbackUserAnswer/SubmitForm",
            data: answerList ,
                dataType: 'json',
                error: function (xhr, status, error) { },
                success: function (response) {
                }
            });
    }

 [HttpPost]
        public IActionResult SubmitForm(List<Feedback_Question> answers)
        {}