Conditionals in the view based on a requested format

i am using respond_to for a few actions in my controller. for some of the actions, the view for html and the view for javascript would be nearly identical.

what can i do in my views to hide or add content based on whether there was an ajax request or not?

Why not just set an instance variable on the controller within the respond_to block and then conditionally render within the view based on it's value?