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 and currently have it working in my app. What i really would
like is to keep all my code in my application.js file vs a bunch of
files all over my view folders.
This is what i have in my application.js
$(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 below the 2 existing form fields.
#{escape_javascript render(:partial => "topics/poll_option", :object
=> TopicOption.new)}
Any thoughts?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---