MVC 3 AJAX Post, List filled with Objects, but Objects Properties are Empty

前端 未结 3 2088
离开以前
离开以前 2021-01-12 02:06

I have the following problem:

On a Button-Click I POST some data to the server. My controller Action looks like this:

public ActionResult Accept(List         


        
3条回答
  •  抹茶落季
    2021-01-12 02:27

    I got the answer!

    jQuery can be confusing at times.

    dataType is the parameter which specifies what you want to get BACK from the server. contentType is the paremeter which specifies what you SEND TO the server.

    So from the example above it works if you add:

    contentType: 'application/json; charset=utf-8',

    in the AJAX-call.

提交回复
热议问题