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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:24:50+00:00 2026-06-11T16:24:50+00:00

How can I call a partial from an Ajax function, I need to render

  • 0

How can I call a partial from an Ajax function, I need to render the content of a partial inside my home.html.erb, here the code:

<div class="span8">
  <h3>Micropost Feed</h3>
    <div class="posts">
        <%= render 'feed' %>
    </div>
</div>

At bottom I have a script, the problem code are in these lines:

if(nearBottomOfPage()) {
  loading=true;
  page++;
  $.ajax({ // send an ajax-request to load the next page
    url: '/feed?page=' + page,
    type: 'get',
    dataType: 'script',
    success: function() { // after successfully completing the ajax-request redraw the    sausage-navigation.
      $(window).sausage('draw');
      loading=false;
    }
  });

The “url” parameter is where I don’t know what to write to call a partial, this partial is call _feed.html.erb and It’s inside the same folder of Home.html.erb, finaly in my controller action I have this:

def home
  if signed_in?
    @post  = current_user.posts.build
    @feed_items = current_user.feed.order(:created_at).page(params[:page])
  end  
  respond_to do |format|
      format.js  { render :partial => 'feed'}
      format.html # index.html.erb
      format.xml  { render :xml => @feed_items }
    end
 end

How can I call that partial from the Ajax function?

Thanks a lot.

  • 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-06-11T16:24:51+00:00Added an answer on June 11, 2026 at 4:24 pm

    You cant call the partial directly via a URL. Only pages/views in the /public dir can be accessed directly.

    You need to create a controller action that renders the ‘feed’ partial, and a corresponding route. Then use the path for that route as your AJAX URL.

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

Sidebar

Related Questions

From this code I can call bmwCars.CopyToDataTable() as I expected. var bmwCars = from
Using a delegate I can call any function asynchronously. From the documentation I understand
(Yes I know I can call Java code from Scala; but that is pointless;
Can someone please let me know by some code how I can call a
I'm working on this website, trying to call a function from a C# DLL
In some MVC frameworks you can call controller action from the view if you
I am struggling with this Ajax call from Rails 2: def add_task_link(name) link_to_function name
I got some uncaught exception basically from an SQL operation via Primefaces AJAX call.
I can call the webservie directly to the browser with the following URL and
In Ruby I can call methods with array elements used as positional parameters like

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.