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 6766215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:48:12+00:00 2026-05-26T14:48:12+00:00

I have a link marked :remote => true that makes a get request to

  • 0

I have a link marked :remote => true that makes a get request to Controller#show as JS and is rendered in the browser. After this request completes another get request for Controller#show as HTML is processed.

While debugging I wrapped the show action contents in if request.xhr? && !request.format.html?

The first Controller#show as js request showed correctly in the browser and the unintended rendering of Controller#show as HTML failed and nothing made it to the browser obviously.

My question is, has anybody experienced this subsequent html call after a js call? I can’t find anything in my code causing this.

Link code

= link_to article.name, blog_path(article.name.downcase.gsub(' ','-')), :remote => true

Controller code

  def show
      article_name = params[:id].gsub('-',' ')

      @article = Article.find_by_name(article_name)

    respond_to do |format|
      format.html # show.html.erb
      format.js
      format.xml  { render :xml => @article }
    end
end

show.js.haml code

$('#content_index.blog').html("#{escape_javascript(render('article'))}");

_article.html.haml code

.blog_post
  %h2
    = @article.name
  %img{:src => "#"}/
  .blog_text
    %p
      = @article.content
%center
  .blog_post_bottom
    #next.blogbuttons next
    #previous.blogbuttons previous
    %p
      posted on
      = link_to @article.created_at.to_s(:date_only), "#"
      in
      %a{:href => "#"} CS at work
      by
      = link_to @article.author_name, "#"

routes.rb code

  resources :articles, :only => [:index, :show]
  resources :blog, :controller => :articles

Log output from single js request (also happens for html request with javascript in the browser disabled)

Started GET "/blog" for 127.0.0.1 at Thu Nov 03 14:38:29 -0400 2011
  Processing by ArticlesController#index as JS
  Article Load (9.3ms)  SELECT `articles`.* FROM `articles` 
Rendered articles/_articles.html.haml (2.3ms)
Rendered articles/index.js.haml (2.8ms)
Completed 200 OK in 20ms (Views: 3.5ms | ActiveRecord: 9.3ms)


Started GET "/blog" for 127.0.0.1 at Thu Nov 03 14:38:30 -0400 2011
  Processing by ArticlesController#index as HTML
  Article Load (9.7ms)  SELECT `articles`.* FROM `articles` 
Rendered articles/index.html.haml within layouts/application (2.7ms)
Rendered user_sessions/_new.html.haml (2.5ms)
Rendered shared/_header.html.haml (3.9ms)
Rendered shared/_footer.html.haml (0.8ms)
Completed 200 OK in 26ms (Views: 9.1ms | ActiveRecord: 9.7ms)
  • 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-26T14:48:13+00:00Added an answer on May 26, 2026 at 2:48 pm

    Turns out that %img{:src => "#"}/ was causing the page to render multiple times. I removed this line and everything worked as it’s supposed. If you need to use an image place holder use = image_tag "" this will cause a routing error but that’s much better than the page rendering multiple times.

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

Sidebar

Related Questions

I have link that calls a function when clicked: <a href=javascript:spawnMenu(this); id=link1>Test1</a> To make
I have a link that opens a Thickbox... <a href=page.php?tag=lists-element&keepThis=true&TB_iframe=true&height=450&width=500> Everything works with this
I have a link that I dynamically create which looks something like the following:
I have a link in a pdf-document (PDF1), which is embedded in a browser
I have a link on a page that pops up a new window, and
I have a link to some style sheet from the Yahoo Developer Network, this
I have this function coded to check the status of a Rapidshare link using
I'm displaying links that get marked as read in a database when a user
I have not marked this question Answered yet. The current accepted answer got accepted
Anyone have a link to what the C++ standard says regarding a compiler removing

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.