Ruby on Rails Sunday, November 29, 2015

i wanna use jquery to render an element identified in the view by <div id="element"> The view is _form.html.erb called by new.html.erb So I have to create a jquery controller with an action to print content through a partial to be sent to replace the element in the form My call to jquery is in the form contained in <script> tags I dunno if I was supposed to use the script tags since I'm using jquery, not javascript raw and then what action would go in the controller Is it the new action? From my form:

<script>
$(#element).on('change', 'a_select_list', function (e) {
  if ($(this).val() == 'a_select_list_option'){
  render 'partial_to_replace_contents_of_element'
  }
});
</script>


--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/b290aaa3-1b97-42a8-87ed-f5b4806d87bf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment