Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7646201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T10:08:49+00:00 2026-05-31T10:08:49+00:00

I am trying to bind model received from Ajax call but that do not

  • 0

I am trying to bind model received from Ajax call but that do not work. Maybe someone could help me?

I am calling ValidateFile Action using Ajax

 $.ajax({
                    url: '@Url.Action("ValidateFile", "Converter")',
                    data: ({ file: fileName, formData: serializedForm }),
                    type: 'POST',
                    success: function (response) {
                        if (response.result) {
                        } else {
                            RemoveFile(fileName);
                        }
                    }
                });

The Fiddler show such query

file=!!!SP+Design!!!.txt&formData%5BEmail%5D=tomas%40mydomain.com

I receive data in my Action with file parameter populated but formData.Email property is always Null

[HttpPost]
public JsonResult ValidateFile(string file, UploadOptionModel formData)
{
}

My UploadOptionModel model

namespace PC.Models
{
    public class UploadOptionModel
    {
        public string Email { get; set; }
    }
}

Form which I am trying to serialize

@model PC.Models.UploadOptionModel
@using (Html.BeginForm())
{
    @Html.EditorFor(p => p.Email)
}

JS Serialization function

function serializeForm() {
    var data = $("form").serializeArray();
    var formData = {};
    for (var i = 0; i < data.length; i++) {
        formData[data[i].name] = data[i].value;
    }

    return formData;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T10:08:50+00:00Added an answer on May 31, 2026 at 10:08 am

    You need to JSON encode the data and set the content type to JSON for the model binder to work with JSON. So try this:

    $.ajax({
        url: '@Url.Action("ValidateFile", "Converter")',
        data: JSON.stringify({ file: fileName, formData: serializedForm }),
        contentType: 'application/json',
        type: 'POST',
        success: function (response) {
            if (response.result) {
            } else {
                RemoveFile(fileName);
            }
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to bind change event to model, but is not working. Here is
Edit: I am trying to bind a single view model object that contains a
I'm trying to model bind a set of dynamically generated checkboxes so as to
I'm trying to bind my view to my view model without DataObjectProvider. The following
I'm trying to bind a view model property to the 'SelectedItem' attribute of a
I'm trying to get a nested model to bind correctly with a nested view
I'm trying to bind two sliders from two separate qooxdoo classes and am looking
I am trying to bind a JTextField to a bean's field that is a
hey. I'm trying to maintain an MVVM model, but am tripping up somewhere when
I am trying to bind a dynamic array of elements to a view model

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.