before was renamed beforeSend... it works very well!

On 12/6/06, Abdur-Rahman Advany <[EMAIL PROTECTED]> wrote:

 Jörn,

thnx, but the problem with that is that other plugin(s) like form.js use
ajax so I need to set some kind of global property. I saw in the source that
this feature is a TODO so I just reimplemented the ajax function with 2
additional conditions.

// Set Accept header based on dataType
if ( s.dataType == 'script' || s.dataType == 'json' )
  xml.setRequestHeader("Accept", "text/javascript, text/html,
application/xml, text/xml, */*");

if ( s.dataType == 'xml' )
  xml.setRequestHeader("Accept", "application/xml, text/xml, text/html,
text/javascript */*");

That seemed to work fine :) It would be nice if the settings where also
passed to the before handler....

Abdul

Jörn Zaefferer wrote:

Abdur-Rahman Advany schrieb:

 Hi,

Is there a way I can change the accept header of ajax requests? as rails
uses the accept header to load rjs (and it would be nice not to prepend
.rjs on all requests).

maybe someone already figure out a way to use jquery ajax and rails to
replace rjs (with minus_r)?

     With the latest revision of jQuery (not yet released, but available via
SVN), you could do something like this:
$.ajax({
    ...,
    before: function(xml) {
       xml.setRequestHeader("Accept", "whatever-you-need-here");
    }
});

Would that do the trick?



_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/





--
Ⓙⓐⓚⓔ - יעקב   ʝǡǩȩ   ᎫᎪᏦᎬ
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to