Skip to content Skip to sidebar Skip to footer

Why @model Haven't Been Passed To Controller's Action Parameter By Jquery Script?

I wanted to pass Person object which is @Model in Details.cshtml(.../Person/Details/id) view to the Test action in PersonController which returns partial view Test.cshtml. The part

Solution 1:

Try to replace

data: { person: '@Model' },

to

data: { person: @Html.Raw(JsonConvert.SerializeObject(Model)) },

JsonConvert.SerializeObject is method from Newtonsoft.Json

Post a Comment for "Why @model Haven't Been Passed To Controller's Action Parameter By Jquery Script?"