I\'m loading a template profile_messages as part of jQuery UI Tabs with Ajax. However when it loads, profile_messages inherits my site\'s applicati
In the controller, add at the end of the "show" action:
render :layout => nil
Or if you render from somewhere else just add the :layout => nil option to render.
The better solution would be to make it a partial and call render :partial => "profile_messages/profile_message" (if you have the template in app/views/profile_messages/_profile_message.html.erb - note the _ in the filename!)
Also instead of using escape_javascript it's actually simpler to ditch the " quotes and use (render ...).to_json.
Do you have a response format of JS defined in your controller? It shouldn't render the layout if it renders a JS response properly. Do your logs show "responding with JS format"?
respond_to do |format|
format.js
end
As mrbrdo mentioned, you can also do render :layout => false but it shouldn't be necessary if the JS response is being run properly.