title: Populate jqGrid selectlist in edit form from MVC controller
body: <p>I am returning a string jqGrid from controller, but dropdown does not populate.</p>
  
  <p>Grid code on View:</p>
  
  <pre><code>        {
              name: 'FundCode', index: 'FundCode', editable: true, edittype: "select",
              editoptions: {
                  dataUrl: '@Url.Action("PopulateDdl", "FundCode")'
              },
              buildSelect: function (response) {
                  var data = typeof response === "string" ? $.parseJSON(response.responseText) : response, s = "&lt;select&gt;";
  
                  s += '&lt;option value="0"&gt;--Select Fund--&lt;/option&gt;';
  
                  $.each(data, function() {
                      s += '&lt;option value="' + data + '"&gt;' + data + '&lt;/option&gt;';
  
                  })
              }
          }
  </code></pre>
  
  <p>Controller method returning the string:</p>
  
  <pre><code>    [HttpGet]
      public JsonResult PopulateDdl()
      {
          var fundCodes = repo.GetFundCodes();
  
          var codeList = new List&lt;string&gt;();
  
          foreach (var t in fundCodes)
          {
              codeList.Add(t.FundCode.ToString());
          }
  
          return Json(codeList, JsonRequestBehavior.AllowGet);
      }
  </code></pre>
  
  <p>This returns a list to the grid but I get an error, "Syntax error, unrecognized expression: ["1", "2", "3", etc ]</p>
  
  <p>I have also tried returning as MVC SelectListItem to same result.</p>
  
  <p>UPDATE - I added the closing select.  It did not fix the issue.  I then noticed the 'buildSelect' was not in the same group as the dataUrl.  I moved it and the error changed. Now the error is "Unexpected token u" it says it is on the line 1.</p>
  
  <p>New view code:</p>
  
  <pre><code>        {
              name: 'FundCode', index: 'FundCode', editable: true, edittype: "select",
              editoptions: {
                  dataUrl: '@Url.Action("PopulateDdl", "FundCode")',
                  buildSelect: function (response) {
                      var data = typeof response === "string" ? $.parseJSON(response.responseText) : response, s = "&lt;select&gt;";
                      s += '&lt;option value="0"&gt;--Select Fund--&lt;/option&gt;';
                      $.each(data, function () {
                          s += '&lt;option value="' + data + '"&gt;' + data + '&lt;/option&gt;';
                      })
                      s += "&lt;/select&gt;";
                  }
              }
          },
  </code></pre>