Rails - Update Bootstrap Popover Content With Partial After Ajax
I'm building out a notifications feature using bootstrap popover. When a user clicks on a notification, it will mark that notification as read through an ajax call. On ajax success
Solution 1:
You could fetch the partial from your controller like so:
class TestController < ApplicationController
def render_partial
notification_id = params[:notification_id]
# Fetch notification data
notification = Notification.find(notification_id)
# Return partial with new notification data
render partial: 'notifications/partials/test_partial', locals: {:notification => notification}
end
end
Then append the response in JS:
$('.notifications-list').append(resp)
Post a Comment for "Rails - Update Bootstrap Popover Content With Partial After Ajax"