Im not sure which group to post in, so i thought i'd try both. Any
Rails peeps that use jQuery? Im having a problem.

I have followed Ryan Bates Screencast about inserting a partial with
jQuery, but i like to keep all my code in my application js.

This is what i have

$(document).ready(function() {
  $('#add_option').click(function() {
    $(this).addPollOption();
  });
});

jQuery.fn.addPollOption = function() {
  $("#poll_options").append('#{escape_javascript render(:partial =>
"topics/poll_option", :object => TopicOption.new)}');
};

i have tried it with the #{} and the <%= %> both give the same result.

Instead of getting the partial to populate the div, it simply adds the
text to the div

#{escape_javascript render(:partial => "topics/poll_option", :object
=> TopicOption.new)}

Any thoughts?

Reply via email to