Rails 3.2 jQuery JSONP request not working - Moved Permanently

I am trying to send a POST request ( ‘remove_tag_named’ )and getting a
simple OK back on success ; it doesn’t work…
the post is correctly sent , but after then it’s looping on sending a
GET
request to the same url, with the error
301 Moved Permanently

I should not be far fro the solution, but I am stuck :

In my routes.rb
namespace :administration do
resource :dashboards, :only => :show do
collection do
post :remove_tag_named
end
end
end

In my view :
= link_to t(:delete), “#”, :id => :delete_tag_link
# generated html =>

  • remove
  • my js.coffee script ( # this should be using JSONP I guess )
    $(‘#delete_tag_link’).bind “click”, (e) →
    selected = $(‘#tags.tab-pane.active #tag-list li
    span.myTag.selected’)
    tagName = selected.html()
    alert 'going remove tag: ’ + tagName # checking I get the correct
    tag
    value
    $.ajax
    url: “/” + locale +
    “/administration/dashboards/remove_tag_named.json”
    type: “POST”
    dataType: “json”
    contentType: “json”
    data: {“tag_name”: tagName }
    success: (result) →
    selected.remove()

    I have also set an init js

    $.ajaxSetup beforeSend: (xhr) →
    xhr.setRequestHeader “X-CSRF-Token”,
    $(“meta[name="csrf-token"]”).attr(“content”)

    and the console output :
    [23:18:24.424] POST
    http://localhost:3000/fr/administration/dashboards/remove_tag_named.json
    [HTTP/1.1 301 Moved Permanently 46ms]
    [23:18:24.491] GET
    http://localhost:3000/fr/administration%2Fdashboards%2Fremove_tag_named.json
    [HTTP/1.1 301 Moved Permanently 34ms]
    [23:18:24.547] GET
    http://localhost:3000/fr/administration%2Fdashboards%2Fremove_tag_named.json
    [HTTP/1.1 301 Moved Permanently 35ms]
    [23:18:24.550] GET
    http://localhost:3000/fr/administration%2Fdashboards%2Fremove_tag_named.json
    [HTTP/1.1 301 Moved Permanently 48ms]
    … more GET…