Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4322042
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T08:49:23+00:00 2026-05-21T08:49:23+00:00

I have been experiencing an intermittent issue in my Rails app, and I’m having

  • 0

I have been experiencing an intermittent issue in my Rails app, and I’m having trouble figuring out what is going on. When the user logs in, they see a dashboard that contains some JavaScript code which performs an AJAX call to an action. Occasionally, instead of seeing the dashboard, when the user logs in, they see the JSON response text from the action instead of the dashboard (in Chrome) or they download a .json file (Firefox). It’s intermittent and doesn’t usually happen, but it’s really annoying when it does occur.

Here’s a dumbed down version of some of the code:

JS running in the template head:

$(function () {
    var remoteLink = $('#remoteLink');
    remoteLink.live("ajax:complete", function () {
        setTimeout(function () {
           loadCount();
        }, 30000);
    });    

    loadCount();

    function loadCount() {
      remoteLink.click();
    }
});

And the link in the template:

<%= link_to 'get count (hidden)', {:controller => 'something', :action => 'count'}, 
            :id => 'remoteLink', :class => 'hidden', :remote => true, 'data-type' => 'json' %>

And the controller action:

def count
    render :json => get_counts_function_returning_a_hash
end

My hunch is that it’s a race condition — perhaps related to the use of setTimeout? — but I haven’t been able to verify that hunch. Can anyone tell me what might be going on here? I’ve seen this in the wild on other sites, too — also intermittent, not generally occurring but annoying when it happens.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T08:49:24+00:00Added an answer on May 21, 2026 at 8:49 am

    Do you have any authentication code that uses store_location or similar functionality to redirect the user to a specific page after they have logged in?

    I once had a similar problem where the AJAX callback was causing store_location to store the JSON URL and the user was redirected to the JSON response rather than their dashboard. This was hard to track down because the user had to sit idle at the page for some time before the bug was manifest.

    In any case, I suspect it is something like this rather than a problem with Rails.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been having intermittent problems with NSURLConnection requests timing out in our iPhone app.
We are using Rails 2.3.5 and have been experiencing seemingly random Timeout::Error: execution expired
I'm experiencing the strangest problem and have been having a terrible time debugging it.
I am experiencing some weird behavior with an android app I have been working
I've previously asked a question about an issue I have been experiencing with CSharpOptParse
I've been experiencing a frustrating issue with Windows Run as Administrator. I have a
I have been experiencing a problem with tortoise . when i checked out the
I have been experiencing a strange issue in Flex Builder 3 where certain dialogs
Lately I have been experiencing Eclipse Galileo (3.5) slowing down under Java 1.5b12 OR
I have been experiencing some frustrations trying to make a simple Oracle cursor retrieval

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.