title: chosen-select mutliple select update from an array
body: <p>I'm using the chosen plugin for a multiple select. I want to retrieve the customer pre-selected values from the database and display them in the multiple select when i return the rest of the data. </p>
  
  <p>The following code works fine: </p>
  
  <pre><code>$('.chosen-select').val(["Test1", "Test2"]).trigger('chosen:updated');
  </code></pre>
  
  <p>However when I try and put a variable in there like below, it doesn't populate the values.</p>
  
  <pre><code>$('.chosen-select').val([res]).trigger('chosen:updated');
  </code></pre>
  
  <p>I've pulled the data out and I then loop through the array and store it in a variable. I've checked the contents of the <code>res</code> variable and it's correct, so now I'd like to reference it within the square brackets but it doesn't work, and it doesn't throw any errors. Any help would be much appreciated!</p>
  
  <pre><code>        var i;
          var res = ""; 
  
          for (i = 0; i &lt; array.length; i++) {
  
              array[i] = $.trim(array[i]);
              var buildValue2 = '"' + array[i] + '", ';
              if (i == array.length - 1) {
                  /* this is the last one so no comma*/
                  buildValue2 = '"' + array[i] + '"';
              }
              res = res.concat(buildValue2);
  
          }
  
          alert(res);
  
          $('.chosen-select').val([res]).trigger('chosen:updated'); 
  </code></pre>