Hi,
I have a form that i want submitting with AJAX, using rails 3 and jquery. The problem that I am facing is that rails is responding to the AJAX request as HTML too. After a little search I found that this has something to do with the correct Accept headers not being passed. How do i fix this?
This is the controller code
respond_to do |format|
format.js { render 'user/create' }
format.html { redirect_to ((params[:feed][:url].nil?)?url_for(:home) : params[:feed][:url]) }
end
It seems to work on a friends firefox, and on my chrome too, smthng wrong with my firefox?
UPDATE: It seems that the error arises only when I use a proxy service as JonDo, which probably changes the accept headers... Is there a way to force rails to use js format if the X-requested-by header is present?
Thanks