ASP MVC 5 How to read object from request with the help of JSON NET

后端 未结 1 1412
野性不改
野性不改 2021-01-24 16:19

I need to use JSON NET serializer.

SiteModelBinder

internal class SiteModelBinder : System.Web.Mvc.IModelBinder
{
    public object BindModel(ControllerC         


        
相关标签:
1条回答
  • 2021-01-24 17:10

    correct ajax call

    $.ajax({ 
            type: "POST",
            url: "/Site/Update",
            dataType: "json", 
            data: {JSON.stringify(filtersData) }, //without name because I'll use custom ModelBinder
            contentType: "application/json; charset=utf-8", 
            traditional: true,
            success: function (data) { 
                alert("ok"); 
            },
            error:function (xhr, ajaxOptions, thrownError) { 
                alert(xhr.status); 
                alert(thrownError); 
            }
        }); 
    
    0 讨论(0)
提交回复
热议问题