MVC 5 AJAX Post DIV Form Seriaiaze to Action Model Always Null?

I cannot post Div values to an MVC Action model, always null. I've tried many article examples and still get nulls. Capturing the .serialize in an alert looks like the pic below. I'm not understanding how an MVC Model can accept a serialize object. It looks like a simple querystring...

Serialized Div Data
Here's my code so far:

$.ajax({
        url: 'Posts/Save',
        data: $("#form1 :input,text,textarea,select,hidden").serialize(),
        type: 'POST',
        contentType: "application/json; charset=utf-8",
        cache: false,
        success: function (result) {
            alert(result);
        },
        error: function (error) {
            alert("ERROR: " + JSON.stringify(error));
        }

    });

[Action]
 public JsonResult Save(PostUpdateViewModel model)
 {
 }
WorknHardrAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gary DavisDir Internet SvcsCommented:
In the POST, the data must not be set correctly. You can look at what the network sends using HttpWatch or Developer Tools in the browser (F12 - network tab). Another thing I'd do would be to use the script debugger in the Dev Tools and set a breakpoint at the start of the Ajax call and view the contents of the expression:

$("#form1 :input,text,textarea,select,hidden").serialize()

and verify it is correctly serializing the expected form field contents.

Also, you mention div contents but the Ajax data is a textarea apparently. I am not sure if your question is stated correctly or the statement is wrong (or neither).

Gary Davis
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
WorknHardrAuthor Commented:
I found another post where they added these properties to Ajax and it started working:

   $.ajax({
         url: 'Posts/Save',
         data: $("#form1 :input,text,textarea,select,hidden").serialize(),
         type: 'POST',
         cache: false,
         contentType: false,
         processData: false,

         success: function (result) {
             alert(result);
         },
         error: function (error) {
             alert("ERROR: " + JSON.stringify(error));
         }
     });
0
WorknHardrAuthor Commented:
Thanks for your help. I found the answer elsewhere...
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.