Hello all,

I am trying to get updated values after ajax update and update them in the html.

Here's an example:

in the cshtml file 

<div id="name">

@Model.name

</div>

<button type="submit" onclick="updateinfo();">submit</button>

$.ajax({
type: form.attr('method'),
url: form.attr('action') + "?handler=ChangeLanguage",
data: {
__RequestVerificationToken: token,
},

success: function (data) {
            $('#name').html(@Model.name); THIS ALWAYS COMES EMPTY EVEN WHEN ITS NOT
}

The controller source example:

[BindProperty]

public string name {get; set;}

public IActionResult OnPostChangeLanguage()

{

string reply = "";

name = "Test"; HERE IS WHERE I AM ASSIGNING VALUE FOR THE PROPERTY BUT NEVER GETS BACK UPDATED TO THE AJAX CALL (ITS ALWAYS EMPTY RESPONSE).

return new JsonResult(reply);

}

Sorry for the coding part I know its not pretty, but its just an example which I think would be enough to get the idea of my problem. 

Anyways let me know if you have any ideas or questions.

Saludos