title: How do I pass data from c# to jquery/javascript?
body: <p>I have a function that I'd like to run when the page loads, so either in document.ready or pageLoad.</p>
  
  <p>Using jquery, I'll trigger the function using its class name</p>
  
  <p>In document.ready</p>
  
  <pre><code>var span = $('.linkify');
  span.html(textToLinks(span.html()));
  </code></pre>
  
  <p>Elsewhere</p>
  
  <pre><code>function textToLinks(text) {
  
      var exp = /(my text)/ig;
      return text.replace(exp, "&lt;a class='link' href='http://www.bbc.co.uk' target='_blank' &gt;$1&lt;/a&gt;");
  </code></pre>
  
  <p>}</p>
  
  <p>Now this works with the simple test data, but I need to now work out how to expand the functionality.</p>
  
  <p>I have a list of terms in my c# app, along with the relevant url. I'm thinking of passing this data as a string, and splitting in, however my javascript knowledge has a lot of holes.</p>
  
  <p>So I suppose I have 3 questions:</p>
  
  <ol>
  <li>How do I get my string into the function when the page is loaded?</li>
  <li>Is a string the right type or can I pass some other dictionary object?</li>
  <li>How do I iterate through each of the terms passed efficiently?</li>
  </ol>
  
  <p>Thanks in advance.</p>