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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T18:58:51+00:00 2026-05-11T18:58:51+00:00

I am using Rails and jquery with RJS templates to perform various AJAX requests.

  • 0

I am using Rails and jquery with RJS templates to perform various AJAX requests.

For most of my Ajax stuff I attach a submit handler to the form in my application.js as follows:

$('#tagging_flickr_photos').submitWithAjax();
$('#tag_submit').click(function() {
    $('#flickr-photos-status').show();

});

This calls the form action which does some processing and then forwards to a RJS template as follows:

$("#flickr-photos-status").hide();
$("#flickr-photos").fadeIn();
$("#flickr-photos").html("<%= escape_javascript(render(:partial => 'flickr_photos_for_tagging_content')) %>");

This works a treat.

Now I am trying to do the same but just based on selecting a different value in a dropdown and not submitting a form.
Here’s my javascript to attach the handler to the dropdown:

$('#film_film_name_id').change(function() {
    $.get('/admin_film/make_tags?film_name_id=' + $("#film_film_name_id").val() + '&film_speed_id=' + $("#film_film_speed_id").val());
});

My controller method does some processing then forwards to the RJS template (make_tags.js.erb):

$("#film_tags").val(<%=@tags%>)

However, the template doesn’t appear to execute.
I can see entries in my logs that it’s calling my method and rendering the template but no matter what I put in the template nothing seems to happen.
I’ve put a Javascript alert in there and it doesn’t fire.

I assume the problem is to do with attaching my Javascript handler but I can’t figure out what I am missing.

Thanks in advance for any help.

  • 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-11T18:58:51+00:00Added an answer on May 11, 2026 at 6:58 pm

    I think you have to tell jQuery that you are expecting JavaScript and that it should be executed. Try the following and see if it works:

    $('#film_film_name_id').change(function() {
      var url = '/admin_film/make_tags?film_name_id=' + $("#film_film_name_id").val() + '&film_speed_id=' + $("#film_film_speed_id").val()
      $.ajax({
        type: 'GET',
        dataType: 'script',
        url: url
      });
    });
    

    Please check the jQuery docs on jQuery.ajax() if it doesn’t work as I haven’t tested the code.

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

Sidebar

Related Questions

I'm using Rails 2.3.8 and have a jQuery AJAX form using posted using: jQuery.fn.submitWithAjax
I am using Rails and jQuery, making an ajax call initiated by clicking a
I have started using jQuery and rails. I have made a simple form that
I am using Rails 3.0.3 with jQuery ujs. I want to send a form
I am confused by how ajax:before works when using rails/jquery-ujs. Does it wait for
I'm trying to make an AJAX enabled web page using rails and jQuery. The
I am developing an app using Rails and jQuery. I would like to submit
I'm using Rails 3.1 and trying to add some ajax functionality (using jquery +
I'm using rails, but doing all my Javascript unobtrusively using jQuery in application.js .
I'm using jQuery with rails and have the following piece of code $('#related').html(<%= render

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.