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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T06:44:37+00:00 2026-06-02T06:44:37+00:00

I am trying to use the Quicksand jQuery plugin to decorate the response of

  • 0

I am trying to use the Quicksand jQuery plugin to decorate the response of an AJAX call in Rails:

Link:

<% Project.services.each_with_index do |service, index| %>
  <%= link_to_function(service, "regatherProjects('#{service}', #{index})", :id => "service_link_#{index}") %>
  <%= " / " if !index.eql?(Project.services.length - 1) %>
<% end %>

JS:

function regatherProjects(service_name, service_id) {
  $.get("/index_project_update", { service: service_name }, function(data) {
    $('#home_projects').quicksand($(data), {
      adjustHeight: 'dynamic'
    });
  });
  $('#home_services').find('a').removeClass("on");
  $('#service_link_' + service_id).addClass("on");
};

Controller:

def index_project_update
  if params[:service] && !params[:service].blank?
    @projects = Project.highlighted.where(:service => params[:service])
  else
    @projects = Project.highlighted
  end
end

View:

$("#home_projects").replaceWith("<%= j(render('projects')) %>")

Projects:

<div id="home_projects">
  <% if @projects.empty? %>
    <p>No projects. <%= link_to_function("View All", "regatherProjects('')") %>.</p>
  <% else %>
   <ul class="all_projects">
     <% @projects.each_with_index do |project, index| %>
       <li data-id="<%= project.customer.name.underscore.downcase %>_<%= project.name.underscore.downcase %>">
       <%= link_to(image_tag(project.project_images.first.image.home), project) %>
       </li>
     <% end %>
   </ul>
  <% end %>
</div>

I think the problem is that the data returned by the AJAX request (see below) is not in the format that Quicksand expects it to be in but I’m not sure how to extrapolate the relevant information from the response. The response from my AJAX request is something like:

$("#home_projects").replaceWith("<some><html><that><i><need>")

So, the problem is that it’s using the above code as the destination code for the Quicksand call when it should be using the replacement HTML:

<some><html><that><i><need>

The AJAX request works perfectly fine, but I need to integrate Quicksand into here.

I need:

  • a better way to do this or;
  • a way to extrapolate the argument for replaceWith() in the aforementioned code to use as the destination code for Quicksand.

If I’ve omitted any information you think you need to help, please ask.

This is the first question I’ve asked on Stack Overflow so I feel obligated to apologise for any misusage.

  • 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-02T06:44:38+00:00Added an answer on June 2, 2026 at 6:44 am

    If anyone runs into a similar issue, the following worked for me in Chrome, Firefox, IE9, IE8 and IE7.

    Link:

    <% Project.services.each_with_index do |service, index| %>
      <%= link_to_function(service, "regatherProjects('#{service}', #{index})", :id => "service_link_#{index}") %>
      <%= " / " if !index.eql?(Project.services.length - 1) %>
    <% end %>
    

    JS:

    function regatherProjects(service_name, service_id) {
      $.get("/index_project_update.html", { service: service_name }, function(data) {
        $('.all_projects').quicksand($(data).find('li'), {
          adjustHeight: 'dynamic'
        });
      });
      $('#home_services').find('a').removeClass("on");
      $('#service_link_' + service_id).addClass("on");
    };
    

    Route:

    match '/index_project_update' => 'application#index_project_update', :defaults => { :format => 'html' }
    

    Controller:

    def index_project_update
      if params[:service] && !params[:service].blank?
        @projects = Project.highlighted.where(:service => params[:service])
      else
        @projects = Project.highlighted
      end
      render :layout => false
    end
    

    View:

    <%= render('application/index/projects') %>
    

    Projects:

    <div id="home_projects">
      <% if @projects.empty? %>
        <ul class="all_projects">
          <li data-id="project">No projects. <%= link_to_function("View All", "regatherProjects('')") %>.</li>
        </ul>
      <% else %>
        <ul class="all_projects">
          <% @projects.each_with_index do |project, index| %>
             <li data-id="project_<%= project.id %>">
               <%= link_to(image_tag(project.project_images.first.image.home, :alt => (project.customer.name + " - " + project.name), :title => (project.customer.name + " - " + project.name)), project) %>
             </li>
          <% end %>
        </ul>
      <% end %>
    </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently trying to use Quicksand, a jquery plugin that allows you to animate
I am need paint my image. I'm trying use JQuery in here this link:
I am trying use the jQuery table sorter plugin for a table that is
Basically.... Get this working... JSFiddle! I am trying to use the jQuery plugin for
I'm trying use jQuery to modify the HTML of the WordPress [caption] shortcode, whose
I am trying use Accrev plugin for visual studio 2010. I am not sure
I am trying use jQuery to poll dynamic DOM nodes, created outside of the
I'm trying use Google iosched as a reference project to learn the best practices
I'm trying use jquery ui tabs together with js and mvc3. <div class=demo> <div
I am trying use neo4j with Ruby on rails on Mac OSX. I have

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.