0

I am trying to delete record from the database using modals, jQuery and javascript but when popup shows I am getting undefined for Gender. How can I represent the value of my enum into a new <td>?

var deleteBtn = null;

function deleteLeague(leagueId, btn) {
  deleteBtn = btn;
  
  $.ajax({
    type: "POST",
    url: "@Url.Action("DeleteLeague", "League")",
    data: {
      id: leagueId
    },
    success: function(data) {
      $("#leagueTBody").html("");
      $("#leagueId").val(leagueId);
      $("#leagueTBody").append("<tr><td>" + data.id + "</td>" +
        "<td>" + data.leagueType + "</td>" +
        " <td> " + data.season.name + "</td>" + " <td> " + data.gender + "</td>" + " <td> " +
        data.note + "</td>" +
        "</tr >");
    },
    error: function(req, status, error) {
      ajaxErrorHandlingAlert("error", req.status);
    }
  });
}

Enum:

public enum Gender
{
  [Display(Name = "Машки")] Male,
  [Display(Name = "Женски")] Female
}

It should be Male or Female in the Gender column.

enter image description here

Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339

0 Answers0