How do I get the attributes of an object that is returned by an action in the javascript ?
This is my code ajax .
Pass the id to the action and it returns an object. I would like to access the values of this object.
function UpdateDataPortfolio(id) {
var parametros = {
cd: id,
};
$.ajax({
type: "POST",
url: "/ManagementTables/UpdateDataPotfolio",
data: parametros,
datatype: "html",
success: function (data) {
alert(data);
},
error: function () {
alert('failure');
}
});
}
This is the action :
[HttpPost]
public Portfolio UpdateDataPotfolio(String cd)
{
if (cd != null)
{
Portfolio port = portfolio.ListbyId(cd);
return port;
}
return new Portfolio();
}