title: Call JavaScript function with Razor syntax
body: <p>I am currently working on an ASP.Net MVC application.
  From my database, I have created three dictionaries and stored them inside a View Model.</p>
  
  <p>After populating said dictionaries with some logic in the controller, I'm accessing these dictionaries in my View via <code>@Model</code></p>
  
  <p>After manipulating these dictionaries, I need to send the data to a JS function to apply some logic to a  JS library called <a href="http://docs.dhtmlx.com/scheduler/" rel="nofollow">DHtmlxScheduler</a> </p>
  
  <p>I have read about the Razor syntax using  <code>@:</code> and am currently using this method to send two string arrays. when trying to access these arrays in the JS function, they only appear to hold <code>System.String[]</code></p>
  
  <p>Here is the code:</p>
  
  <pre><code>var weekArray;
  var engArray;
  
  @foreach(var week in Model.WeeklySchedule)
  {
      var key = week.Key;
      var values = week.Value.ToArray();
      var eng = Model.EngineerSchedule.Where(k =&gt; k.Key == key).Select(v =&gt; v.Value).ToArray();
      string test = "hello";
  
      @: gatherTimes('@values', '@eng');
  }
  
  function gatherTimes(values, engs)
  {
      for(var i = 0; i &lt; values.length; i++)
      {
          alert(values[i]);
      }
  
      //alert(values);
      //alert(engs);
  
      //weekArray[weekArray.length] = values;
      //engArray[engArray.length] = engineers;
  }
  </code></pre>
  
  <p>I eventually plan on looping through the arrays, they hold information about time slots and engineer IDs. If there is any more information I may provide, I will do my best to do so.</p>