Reputation: 356
I'm looking to refresh the the table "dashboard_categories" when I click submit without the whole page refreshing, this is what I've done so far: http://pastie.org/7822560
I'm now stuck on what I do with Javascript as I'm a complete novice. I know I have to catch the form submission, send the data and then call the partial to refresh... but have no clue how. Any ideas?
Hopefully I'm not far off...
I've got a content_for tag for the javascript on index.html.erb:
<% content_for :javascript do %>
<script type='text/javascript'>
</script>
<% end %>
Upvotes: 0
Views: 109
Reputation: 21795
Include unobtrusive javascript driver in your manifest app/assets/javascript/application.js
:
//= require jquery_ujs
And then mark the form to be submitted by AJAX:
<%= form_for(@category), remote: true do |f| %>
Upvotes: 2