I have template: blabla.haml And 2 layouts:
layouts/application.js.erblayouts/application.html.haml
In controller i have render 'blabla.haml' In log: request.xhr? # true
So if I send request with ajax I still get html answer: text/html and layouts/application.html.haml as layout
What should I do to get correct js answer?
in your controller you should have something like:
you could as well implement it with respond_with something like:
or even in your ajax query, for example, with jquery ($.ajax, $.get, $.post, $.getScript, etc) you can force the content type, something like:
});