Hexa's Blog

Ruby On Rails: Javascript did not active after follow a link

02/03/2014 Ruby on Rails 4

Description: After writing javascript code, There is an error, when users click on the hyperlink, javascript does not run. However, if users refresh the web page, javascript run automatically.My project using Jquery.

Instead of writing code like:

$(document).ready ->
  alert("page is load")

You should write:

$(document).on "page:change", ->
  alert "page has loaded!"