troubleshooting Question

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

Avatar of WorknHardr
WorknHardr asked on
ASP.NETJavaScript
3 Comments1 Solution1512 ViewsLast Modified:
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)
 {
 }
ASKER CERTIFIED SOLUTION
Gary Davis
Dir Internet Svcs

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros