title: How do I properly put embedded ruby code in to JavaScript?
body: <p>I am trying to embed the output of Ruby code in JavaScript:</p>
  
  <pre><code>var stuff= "&lt;% Representative.get('http://0.0.0.0:4568/') %&gt;";
  </code></pre>
  
  <p>The embedded part is working by itself showing a result like this:</p>
  
  <pre><code>{ "name":"John Johnson", "street":"Oslo West 555", "age":33, "phone":"555 1234567"} 
  </code></pre>
  
  <p>The line above is the EXACT PAGE SOURCE; it runs locally though, so I can't show you the page.</p>
  
  <p>When in a variable, I try to send it to my application with this:</p>
  
  <pre><code>document.getElementById("X_Axis").value=stuff.name;
  </code></pre>
  
  <p>through the input:</p>
  
  <pre><code>&lt;input type="text" id="X_Axis" /&gt;
  </code></pre>
  
  <p>I get a <code>undefined</code> value every time.</p>
  
  <p>I tried hardcoding the value in the JavaScript and it works fine like that, put when the embedded Ruby is put into the JavaScript variable, it always gives me the <code>undefined</code> value.</p>