Set data in javascript file via backend c#
<p>I have the following situation.
I want to show a (donut) graph with data in my web page.
I'm getting the data from my database in my backend of my webpage (ASP.NET/C#).</p>

<p>I'm using a standalone javascript file ('graph.js') for the graph:</p>

<pre><code>//Donut Chart
var donut = new Morris.Donut({
element: 'sales-chart',
resize: true,
colors: ["#3c8dbc", "#f56954", "#00a65a"],
data: [
  { label: "**DATA**", value: **10** },
  {label: "**DATA**", value: **30**},
  {label: "**DATA**", value: **20**}
],
hideHover: 'auto'
});
</code></pre>

<p>Is there a good way of putting the data in the javascript file? (Changing the <strong>DATA</strong> variables)</p>

<p>I know it's possible to put the javascript in script elements on my aspx page, and getting my data there:</p>

<pre><code>var DataNumber = &lt;%=DataNumber%&gt;;   
</code></pre>

<p>And giving this data in the backend:</p>

<pre><code> private String _dataNumber = String.Empty;
 protected string DataNumber {
     get {
         return this._dataNumber ;
     }
     set {
         this._dataNumber = value;
     }
 }
</code></pre>

<p>but that's not what i'm looking for.
I realy want to use an standalone file for this.</p>