Reputation: 6499
I'm making a simple POST request via jquery's .ajax function to a routed URL in rails, but can't get a simple response.
Is there any way of setting up a simple response in rails without using any of the AJAX helper functions? In PHP, you can just echo a simple response out, but rails seems to want to wrap everything in HTML.
Upvotes: 0
Views: 1909
Reputation: 108
For simple response (I guess you need just to output some text) you can use
render :text => "Whatever you need to response" #in your controller
Upvotes: 2
Reputation: 21884
I think you need to specify that you dont want to render the layout if request.xhr?.
In controller
layout :layout_for_type
def layout_for_type
request.xhr? ? nil : "application"
end
Upvotes: 1