title: Rails 3: jquery.idletimeout plugin's remote requests are failing
body: <p>I'm using the jquery.idletimeout plugin with the following in my application.js:</p>
  
  <pre><code>jQuery.idleTimeout('#session_timeout', '#session_timeout a', {
    idleAfter: 600,
    pollingInterval: 15,
    keepAliveURL: '/session',
    serverResponseEquals: 'OK',
    // Additional "on" event functions...
  });
  </code></pre>
  
  <p>Here is some relevant Ruby code:</p>
  
  <pre><code># /app/controllers/sessions_controller.rb
  class SessionsController &lt; ApplicationController
    respond_to :html, :only =&gt; [:new, :create, :destroy]
    respond_to :js, :only =&gt; [:show]
  
    # Used by the jQuery.idleTimeout plugin
    def show
      if current_user_account # method to check for logged in user
        render :text =&gt; 'OK'
      else
        render :text =&gt; 'NOT OK', :status =&gt; 404
      end
    end
  end
  
  # /config/routes.rb
  resource :session
  resources :sessions
  get 'login' =&gt; "sessions#new", :as =&gt; "login"  
  get 'logout' =&gt; "sessions#destroy", :as =&gt; "logout"
  </code></pre>
  
  <p>However, when a page is loaded, my browser's (Chrome) Network console is showing the following (and Firefox's shows an "Aborted" status):</p>
  
  <p><img src="https://i.stack.imgur.com/qDCuo.png" alt="Screenshot"></p>
  
  <p>Requests from the plugin to '/session' are made, but something is messing up. The plugin is seeing these 5 responses as failed and is therefore aborting. To test, I created the following remote link to the same controller/action:</p>
  
  <pre><code>&lt;%= link_to 'test remote session', session_path, :remote =&gt; true %&gt;
  </code></pre>
  
  <p>If I click this everything seems to work fine. (Last request in screenshot above.) I noticed in my development.log file a difference between the plugin's request and the remote link's request:</p>
  
  <pre><code># Request from plugin:
  Started GET "/session" for 127.0.0.1 at 2011-06-16 13:31:33 -0400
  Processing by SessionsController#show as 
  ...
  Rendered text template (0.0ms)
  Completed 200 OK in 898ms (Views: 1.0ms | ActiveRecord: 21.8ms | Sphinx: 0.0ms)
  
  # Request from remote link:
  Started GET "/session" for 127.0.0.1 at 2011-06-16 13:33:36 -0400
  Processing by SessionsController#show as JS
  ...
  Rendered text template (0.0ms)
  Completed 200 OK in 918ms (Views: 1.0ms | ActiveRecord: 2.5ms | Sphinx: 0.0ms)
  </code></pre>
  
  <p>The remote link request shows "...#show as <strong>JS</strong>" while the plugin's doesn't include the "JS". Not sure if this is part of the problem...</p>
  
  <p>Anyway, this is long, but does anyone see what the issue is? Thank you.</p>