title: Convert viewbag to javascript array
body: <p>I want to get the data from the ViewBag.mytags to a Javascript array, but I was not able to avhice this</p>
  
  <pre><code>$(function () {
      var sampleTags = new Array();
      var array = @Html.Raw(Json.Encode(@ViewBag.mytags));
      for(var i =0; i&lt;array.length;i++){
          sampleTags[i] = array[i];
      }  
      $('#singleFieldTags').tagit({
          availableTags: sampleTags,
          singleField: true,
          singleFieldNode: $('#mySingleField')
      });
  }
  </code></pre>
  
  <p>This is  my controller</p>
  
  <pre><code>ViewBag.mytags = mp3.TagSuggestion();
  </code></pre>
  
  <p>This is my Models</p>
  
  <pre><code>public IQueryable&lt;string&gt; TagSuggestion() 
  { 
  
      IQueryable&lt;string&gt; tabs = from s in db.tblTags select s.Title; 
  
      return tabs; 
  
  } 
  </code></pre>