title: TypeError: a is undefined with Select2 plugin in asp.net MVC?
body: <p>I create my Select on the on change event of another dropdown, so here is my script:</p>
  
  <pre><code>$ddlOther.on('change', function(e) {
          var Json = {},
              persons = [];
          Json.id = $(this).val();
  
          $.post('/PersonController/GetPersonDDL', Json, function(data) {
              drivers = data;
          }, 'json').done(function(data) {
              $person.select2({
                  placeholder: "Select Persons(s)",
                  allowClear: true,
                  multiple: true,
                  data:  persons
              });
          });
      });
  </code></pre>
  
  <p>This is my controller method:</p>
  
  <pre><code>public ActionResult GetPersonDDL(JsonDictionary args)
  {
       JsonResult result = null;
  
       string id= args["id"].Trim();
  
       var persons = _context.Persons
                             .Where(x =&gt; x.id== id)
                              .Select(x =&gt; new 
                                               { x.first_name, 
                                                 x.middle_name, 
                                                 x.last_name, x.id
                                                }).ToList();
  
  
       foreach (var person in persons)
       {
               var item = new SelectListItem
               {
                     Text = string.Format("{0} - {1} {2} {3}", 
                                                            person.id, 
                                                            person.first_name, 
                                                            person.middle_name,
                                                            person.last_name),
                      Value = person.id
  
                      };
  
                      list.Add(item);
                  }
  
        result = Json(list.Select(x=&gt;new {value = x.Text, 
                                          id = x.Value}
                                  ), JsonRequestBehavior.AllowGet);
  
  
        return result;
  }
  </code></pre>
  
  <p>I get data back, but the console (firebug in this case) gives me the error:</p>
  
  <pre><code>TypeError: a is undefined
  </code></pre>
  
  <p>The <code>JSON</code> returned looks like this:</p>
  
  <pre><code>[ 
    Object { value="John Doe", id="1"}, 
    Object { value="Jane Doe" id="2"} 
  ]
  </code></pre>