I have this simple list of users in my model. If we click one user, I would like to set that user as the chosen one and refresh the partial view. My code looks like:
<div id="myPartialView">
@if (@Model.ChosenUser != null)
{
@Model.ChosenUser.UserName
}
<ul>
@foreach (var u in Model.Users)
{
<li>
<a href='@Url.Action("ChooseUser", "Controller", new { userId = u.UserId })'>@u.UserName</a>
</li>
}
</ul>
The controller method returns an Ok(); My current code redirects me to an empty page and I have to go back and refresh the page in order to see the model changes.
My question is, how can I refresh only this partial view after the razor action?