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

  • Home
  • SEARCH
  • 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 7612803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:00:27+00:00 2026-05-31T02:00:27+00:00

My index.js.erb is refreshing the page only partially: $(#view).html(<%= escape_javascript render ‘view’ %>); I

  • 0

My index.js.erb is refreshing the page only partially:

$("#view").html("<%= escape_javascript render 'view' %>");

I am able to refresh it fully in the controller with this line:

format.js { render :js => "window.location.replace('#{url_for(:controller => :view, :action => :index, :some_parameter => value)}');" }

Is it possible to refresh the page in js.erb?

edit:
I call index.js.erb by this command in the controller:

format.js { redirect_to(:action => :index, :format => :js, :some_parameter => value)}, 

It refreshes the page with the content for some_parameter, but refreshes it only partially.

window.location works better, but I read in one of stack overflow posts that it is better to use erb than controller for javascript. Is it really?

  • 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-31T02:00:29+00:00Added an answer on May 31, 2026 at 2:00 am

    For the second way, you’re refreshing the whole page( made another http request ) and if you want to do this, why not just use redirect_to?

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

Sidebar

Related Questions

In my rails view(index.html.erb), i have following structure <div> <%= render :partial => create
I have 3 files: index.html.erb is my homepage inside the index I render a
I am using rails beta 3 and I have a erb page named index.html.erb
Here is my index.html.erb : <%= render :action => 'new' %> <% unless @posts.empty?
I have config/routes.rb routed to app/view/home/index.html.erb index.html.erb is linket to app/assets/stylesheets/home.css It works fine
I have a login form (/user). And methods: -authenticate -logout And one view index.html.erb,
I have an index.html.erb file with the following: <%= render @users %> This renders
I have an index.html.erb page timesheet that has various js and jquery tables and
Typical usage is: respond_to do |format| format.html # index.html.erb format.xml { render :xml =>
I'm building a blog using RoR. I have the index.html.erb page for the posts

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.