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:
classTestController < ApplicationControllerdefrender_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}
endend
Then append the response in JS:
$('.notifications-list').append(resp)
Post a Comment for "Rails - Update Bootstrap Popover Content With Partial After Ajax"