Reputation: 112
My rails app load application.js functions only when im refresh the page,in other case (site surfing,AJAX operations) it doesent.So how to load application.js every server-client actions?Every function pulled inside the
$(document).ready(function() {
Upvotes: 0
Views: 129
Reputation: 4713
$(document).ready(function() {
will not work properly with Turbolinks enabled since it'll be triggered just once, you want to use this instead:
var ready;
ready = function() {
...your javascript goes here...
};
$(document).ready(ready);
$(document).on('page:load', ready);
See this link for more information: Rails 4: how to use $(document).ready() with turbo-links
Upvotes: 1