i have 3.0 which I upgraded to 3.1 a while ago. I am trying to now add a bit of ajax into the project, but for some reason while it looks set up correct and the link fires as remote link the response it returns is html.
so I’ve set the controller like so:
respond_to do |format|
format.js
end
in the view:
%li=link_to comp.title, company_filter_path(comp.id), :remote=>true
but in firebug it’s returning a page like this:
<!DOCTYPE html>
<html>
<head>
<title>test</title>
</head>
<body id='home' lang='en'>
<section>
<!-- = content_tag :h1, yield(:title) if show_title? -->
alert("hello")
console.log(2)
</section>
</body>
</html>
I think it might be something i missed on the upgrade but I can’t see what, anyone got any thoughts?
A friend gave me the answer for anyone facing the same issue.
I was defining the layout in the application folder and this forced the js to render as a template.
changing the format to :
and everything works perfectly!