I have the following code to force the HTTP_ACCEPT header when doing
ajax calls so that my Rails app can properly interpret the request
using it's respond_to block:

$.ajaxSetup({
        beforeSend: function(xhr) {xhr.setRequestHeader("Accept", "text/
javascript");}
});

This is working fine with Firefox, however with IE 6 or 7 the new
Accept header is being appended to the end of the HTTP_ACCEPT string
instead of replacing it, so it now becomes: "text/html, */*, text/
javascript". The problem with this is that the Rails respond_to block
will intercept the request as html first so it won't reach the JS or
XML blocks.

For the moment I have a before_filter in my Rails app to set the
correct header, but that's too hackish for my liking.
Has anyone come across this or are there any suggested work arounds?

Reply via email to