Thinh Phan


10 Experience
0 Lessons Completed
0 Questions Solved


A little bit late but hope this will help others. In my case, I can't make the Request.js#get work, so I use fetch instead. The controller response as turbo-stream format so you must tell the client to render it - Turbo instance is automatically assigned to window.Turbo upon import import "@hotwired/turbo-rails"

    fetch(url, {
      method: 'GET',
      mode: 'cors',
      cache: 'no-cache',
      credentials: 'same-origin',
      headers: {
        'Accept': "text/vnd.turbo-stream.html",
        'X-CSRF-Token': csrfToken
    .then(response => response.text())
    .then(html => Turbo.renderStreamMessage(html)) // this will render the turbo-stream as HTML
logo Created with Sketch.

Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

© 2022 GoRails, LLC. All rights reserved.