title: Ruby on rails Ajax call showing 404 error
body: <p>I am making and ajax call to hit the controller but it is showing the 404 error:</p>
  
  <p><strong>My controller method is like:</strong></p>
  
  <pre><code>def get_user_time
      if(params[:user])
          @user_time_checks = UserTimeCheck.where(:user_id =&gt; params[:user])
      end
  end
  </code></pre>
  
  <p><strong>And my route for this is like:</strong></p>
  
  <pre><code>post "user_time_checks/get_user_time"
  </code></pre>
  
  <p><strong>And my ajax script is like:</strong></p>
  
  <pre><code> function get_user_time(id) {
       var user_id = id;   
       if(user_id != ''){       
          $.ajax({
            url:"get_user_time?user="+user_id,
            type:"POST",
            success: function(time){
              console.log(time);
            },error: function(xhr,response){
              console.log("Error code is "+xhr.status+" and the error is "+response);
            }
          });
        }
    }
  </code></pre>