取得AJAX 404错误

This is my second ever attempt at trying to get AJAX to work in an app and I'm stuck. I have a link and I'm trying to render a chart. I tried with different routes but I'm pretty sure this one is the correct syntax, but I am getting the error: GET http://localhost:3000/players/getdata 404 (not found).

I am using Rails 4 if that matters.

<%= link_to "Show Chart", getdata_path, remote: true, method: 'GET', class: "btn" %>

players/getdata.js.erb

$(function () {
  $('#container').highcharts({
   ...
  });
});

routes.rb

get '/players/getdata' => 'players#getdata', as: :getdata

players_controller

def getdata
    respond_to do |format|
        format.js
    end
end

EDIT: rake routes gives:

 getdata GET    /players/getdata(.:format)  players#getdata

fixed it by changing routes to

get '/getdata' => 'players#getdata', as: :getdata