title: Changing JS Code from Code behind
body: <p>I'm trying to draw a chart on my website. Here is the js code for the chart with sample inputs </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>&lt;script type="text/javascript"&gt;
      $(function () {
        var d2 = [[0, 3], [4, 8], [8, 5], [9, 13]];//these are sample
        $.plot("#placeholder", [d2]);
         });
  &lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Here is what i wanna do. I want to take some information from the database and put it to the chart. I wrote down the code for taking information. But i couldn't manage how to insert them to the js code for the chart.</p>
  
  <pre><code>using (var db = new Entities())
  { var q = from u in db.Sites
            where u.SiteURL == result.SiteURL
            select u;
  if (q.Any()) {
          List&lt;webpagespeedtest_flat.DataModel.Sites&gt; l = new List&lt;webpagespeedtest_flat.DataModel.Sites&gt;();
          l = q.OrderByDescending(s =&gt; s.CheckDate).Take(10).ToList();
          webpagespeedtest_flat.DataModel.Sites[] z = l.ToArray();
  int x = z.Count();
  for( int i=0; i &lt; z.Count(); i++){
   z[i].Score; // --&gt; this will be the first attribute(x)
   z[i].CheckDate;// --&gt;this will be the second attribute(y)
  }
  </code></pre>