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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:06:59+00:00 2026-05-14T03:06:59+00:00

Ok I have this problem I’m trying to use Jquery to load a partial

  • 0

Ok I have this problem I’m trying to use Jquery to load a partial in replace of a listed object.

index.html.erb

<div class="style_image_<%= style.id %>" > <%=link_to image_tag(style.cover.pic.url(:small)), style %></div>

loadshow:

$(function() {
    $(".style_image_<%= style.id %> a").click(function() {
    $(".style_image_<%= style.id %>").html("loading... ")
    $(".style_image_<%= style.id %>").html("<%= escape_javascript(render("show")) %>")
    $.get(this.href, null, null, "html");
    return false;
  });
});

_show.html.erb:

<%=link_to image_tag(style.cover.pic.url(:normal)), style %>

I’m getting this error:

missing ) after argument list
[Break on this error] $(".style_image_<%= style.id %>").htm...scape_javascript(render("show")) %>")\n

There is two problems with my code here the first is the click function is not targeting the .style_image_<%= style.id %> …. i.e (.style_image_42) if I replace the css target with 42 instead of _style.id the click target works; why is this?

And with or without this change the _show partial is not render and the above error is given.

Not really that good with Javascript any help would be great!

P.s.

The effect I really want is like one of those super cool cargo themes: http://cargocollective.com/publikspace

Thanks Dan!

alt text http://s3.amazonaws.com/data.tumblr.com/tumblr_kzu1cnOUUs1qbto6oo1_1280.png?AWSAccessKeyId=0RYTHV9YYQ4W5Q3HQMG2&Expires=1269597925&Signature=XuwwBhKKCKu3FWGpmqXmBqwxzS0%3D

  • 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-14T03:07:00+00:00Added an answer on May 14, 2026 at 3:07 am

    Still not sure why my js.erb file don’t understand <%=style.id%>, maybe it’s not the done thing to do here.

    I have two solutions for this problem:

    1. write the javascript in the controller and use a link_to_remote.

    2. Unobtrusively Load link path in to the DIV of the link:

    Image_tag link as above!

    and in my Application.js file

    $(function() {
    
    $(".style_image a").live('click', function(event) { 
    
        $(this).closest(".style_teaser").load(this.href + " #show_photo");
    
    
        return false;       
    
    });
    });
    

    With this method if javascript is off link will tak you to the show path of the object.

    Thanks goes out to Nick Craver for give me the heads up on this!

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

Sidebar

Related Questions

I have this problem, when I load my form, the validation messages appears in
I have this problem. Session does not work when I use with $_POST. If
I have this problem, I'm trying to put a String variable in the value
I have this problem and I'm trying to solve it using jsfiddle but I'm
I have this problem. I have a module (module 1) that use Nhibernate to
I have this problem with UISearchDisplayController . I want to use it in a
I have this problem: I want to generate a new source code file from
I have this problem: $id is id for each user $img = 'http://www.somesite.com/pictures/'; $no_img
I have this problem since I'm beginning in OOP programming I want to close
I have this problem when I run SAS 9.2 on the command line on

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.