On 05/31/2011 04:04 PM, Matt Wagner wrote:
On Tue, May 31, 2011 at 03:57:46PM +0200, Jan Provaznik wrote:
>> + # XMLHTTPRequest in many browsers sends "Accept: */*", so the first
respond_to will match.
>> + # See http://codetunes.com/2009/01/31/rails-222-ajax-and-respond_to/
>> + # http://www.grauw.nl/blog/entry/470
>> + def js_for_xhr
>> + request.format = :js if request.xhr?
>> + end
> We must remove this very soon/now - with backbone integration we gonna
> fetch json data through ajax request (fetch won't work because of this
> hack). In case some browsers send incorrect Accept header we can set
> Accept header explicitly in jquery ajax() call.
Oh, interesting. We should probably set this header explicitly across
the board, as this seems to be fairly common and was happening for me in
Firefox, and it doesn't hurt to be explicit in the request.
Set this globally (through ajaxSetup) sounds good, shouldn't be problem
with backbone which sets explicitly json.
Are you in the process of replacing this now, or do you need me to
Not yet, I'm afraid I'm not gonna make this today. If you want to grab
this - great, if not I can do it tomorrow.