Skip to main content

Bug Tracker

Side navigation

#7424 closed bug (worksforme)

Opened November 07, 2010 08:01AM UTC

Closed November 07, 2010 03:10PM UTC

Last modified April 13, 2012 10:08PM UTC

setRequestHeader IE

Reported by: uthomas Owned by:
Priority: low Milestone: 1.5
Component: ajax Version: 1.4.3
Keywords: Cc:
Blocked by: Blocking:

Hi there again.

I'm afraid last time my ticket was handled as spam...

I'm trying to add a custom header to each dynamic HTTP Request and it seems working fine in FF, Safari, Chrome, and Opera but not under IE 8 (build: 8.0.7600.16385).

Morover I can't see either the "x-requested-with" header in IE.

Here is my code:

        beforeSend : function(xhr) {
                xhr.setRequestHeader("custom-header", "custom-value");

    $('#button').click(function() {
            url   :   '/valid-url',
            success: function(data){

Best regards: U. Tamás

Attachments (0)
Change History (6)

Changed November 07, 2010 02:34PM UTC by uthomas comment:1


At least "X-Requested-With" works in IE too, but I had to add:

            type    :   'POST',
            data    :   '',

to the the parameter-list of $.ajax call. :)

So my code looks like this now:

    $('#button').click(function() {
            type    :   'POST',
            data    :   '',
            url     :   '/a-valid-url',
            success :   function(data){
            error   :   function(data) {

Changed November 07, 2010 02:46PM UTC by uthomas comment:2


With the added two lines the "custom-header" has been sent in IE as well... :S

I find it weird that without explicitly telling the request-method (POST|GET) the request header doesn't contain the "custom-header" in IE, but it works in other browsers. :)

Best regards: U. Tamás

P.S.: jQuery is great! Just keep go on!

Changed November 07, 2010 03:10PM UTC by rwaldron comment:3

resolution: → worksforme
status: newclosed

Changed January 31, 2011 04:08PM UTC by jitter comment:4

component: unfiledajax
priority: undecidedlow

Changed June 17, 2011 02:13PM UTC by comment:5

Changed April 13, 2012 10:08PM UTC by anonymous comment:6

setRequestHeader() does not work at all. How can it be a low priority?