turbolinks / turbolinks-classic

Classic version of Turbolinks. Now deprecated in favor of Turbolinks 5.
MIT License
3.54k stars 428 forks source link

Enable Turbolinks on a-tags after adding content over AJAX #659

Open patricklehmann opened 8 years ago

patricklehmann commented 8 years ago

Hi guys

I'm having the following markup:

<body>
  <header id="sq-header" data-turbolinks-permanent></header>

  <section data-turbolinks-temporary>
    = yield
  </section>

And this small piece in a coffeescript file.

'use strict'

$(document).on 'ready', (event) ->
  $.get('/templates/header', ( template_data ) ->
    $('#sq-header').html(template_data)
  )

/templates/header returns a navigation with some links. Unfortunately turbolinks is not working when hitting these links. I think it's because turbolinks isn't enabled on this markup. Is there a way to re-enable it?

Thanks for your reply!

Regards, patrick

sebastianpicklum commented 8 years ago

Is there any reason why this piece is loaded via AJAX? Seems like an unnecessary server round-trip to me.