title: Why I cant use Ajax in Rails?
body: <p>I started learning Rails 3 months ago.And now I'm trying to add Ajax in my Rails app.</p>
  
  <p>So it have some problems.</p>
  
  <p>In my Index.html.erb file:</p>
  
  <pre><code>&lt;script&gt;
      function loadDoc() {
        var xhttp = new XMLHttpRequest();
        xhttp.onreadystatechange = function() {
          if (xhttp.readyState == 4 &amp;&amp; xhttp.status == 200) {
            document.getElementById("demo").innerHTML = xhttp.responseText;
          }
        };
        xhttp.open("GET","demo.txt", true);
        xhttp.send();
      }
  &lt;/script&gt;
  
  &lt;button type="button" onclick="loadDoc()"&gt;click&lt;/button&gt;
  
  &lt;p id="demo"&gt;&lt;/p&gt;
  </code></pre>
  
  <p>And I created a file that demo.txt.I try to show content in demo.txt when I click the button.But it shows nothing.</p>
  
  <p>So have any tut for me.</p>
  
  <p>Thanks !</p>