title: Selecting Enum items on AJAX call
body: <p>I am working on action result which returns JSON data to view and then loads on textFields by AJAX call</p>
  
  <p>Action:</p>
  
  <pre><code>public ActionResult loadInf(string custm)
  {
      int smclientbranchid = Convert.ToInt32(Session["smclientbranchid"]);
      var query = (from parent in db.Customer
                   join child in db.CustomerAddress on parent.CustomerId equals child.CustomerId
                   where parent.SMClientBranchId == smclientbranchid &amp;&amp; parent.NIC == custm
                   select new SalesVM
                   {
                      Indicator = parent.Indicator,
                      //code removed
                   }).ToList();
      return Json(query);
  }
  </code></pre>
  
  <p>In View:</p>
  
  <pre><code>@Html.DropDownListFor(model =&gt; model.Indicator, 
      new SelectList(Enum.GetValues(typeof(ColorTypes))),
      "&lt;Select&gt;", 
      new { @class = "form-control", id ="Indicator" })
  
  &lt;script type="text/javascript"&gt;
      $(document).ready(function () {
          $("#btnSearchCus").click(function () {
              var custm = $('#custm').val();
              $.ajax({
                  cashe: 'false',
                  type: "POST",
                  data: { "custm": custm },
                  url: '@Url.Action("LoadCustomerInfo", "Sales")',
                  dataType: 'json',  // add this line
                  "success": function (data) {
                      if (data != null) {
                          var vdata = data;
                          $("#Indicator").val(vdata[0].Indicator);
                          //code removed
                      }
                  }
              });
          });
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>I am getting data right and also loading right except the "Indicator" field, which is of type enum.</p>
  
  <p>How can I select an enum list item from the data I get.</p>
  
  <p>For example:</p>
  
  <blockquote>
    <p>0,1,2,3 index order</p>
  </blockquote>