title: Rails ajax call 404 not found routing error
body: <p>I was playing around with ruby on rails and tried making ajax call but kept seeing an error.
  So in my index.html.erb, I have a button with id test. And in the same index file, I have</p>
  
  <pre><code>("#test").click(function(){
      $.ajax({ 
        type: 'POST', 
        url: '/test', 
        data: {key: 'value'}, 
        dataType: 'script',
      });
  });
  </code></pre>
  
  <p>So, when I click on the button with id test, I keep seeing </p>
  
  <pre><code>POST http://localhost:3000/test 404 (Not Found)
  </code></pre>
  
  <p>I cannot seem to figure out why because in my config/routes.rb, I have get '/test', to: 'prompts#test' and in my promptsController, I have </p>
  
  <pre><code>def test
    puts "enters here"
  end
  </code></pre>