I'm sending simple ajax call :
axios({
method: "post",
url,
headers: {
"Content-Type": "application/javascript",
"X-CSRF-Token": headerToken()
}
})
to the following action :
def search
@products = ::Product.search(params[:keyword])
end
the .js.erb template get correctly returned, however the javascript contained in it does not get parsed, rather rendered as plain text
form = document.querySelector('form');
Rails.fire(form, 'submit');
Same result.
What setup is missing here ?