I send an id from the page to the server, the answer comes - this is a model object found by id, how can I get the item (Price) I need from it? Script:
var data = { Id: null, Name_Product: null, Price: null, Description: null } $.ajax({ url: '/editpr', type: 'POST', data: JSON.stringify({ id: tested }), contentType: "application/json; charset=utf-8", //dataType: 'JSON', success: function (data) { var Price = data.Price var newinput = document.createElement('input') newinput.className = 'save_inp' newinput.id = 'id_save_inp' newinput.value = Price $('.price').html(newinput) Controller Code:
public Products Editproducts([FromBody] int id) { // Products Product = null; DBEntities bd = new DBEntities(); Products SenMes = bd.Products.Find(id); if (SenMes != null) { Products product = new Products { Id = SenMes.Id, Name_Product = SenMes.Name_Product, Description = SenMes.Description, Price = SenMes.Price, MesAndProduct = SenMes.MesAndProduct }; // Product = SenMes; return product; } return null; } And that's what I get in the end ... 
How do I get rid of undefined and get a price that will match this id?
null. And then make sure that it is correct (so that the client can parse it) is sent to the client. - Regentdata.Pricedoes not get the value you need, it means that jQuery is not able to parse the response from the server. At least give an example of the data returned by the server. - RegentActionResultin this case, we rather needJsonResult, what isProductsfor you? - teran