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: |
Description
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:
$.ajaxSetup({
beforeSend : function(xhr) {
xhr.setRequestHeader("custom-header", "custom-value");
}
});
$('#button').click(function() {
$.ajax({
url : '/valid-url',
success: function(data){
alert(data);
}
});
});
Best regards: U. Tamás
Attachments (0)
Change History (6)
Changed November 07, 2010 02:34PM UTC by comment:1
Changed November 07, 2010 02:46PM UTC by 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 comment:3
| resolution: | → worksforme |
|---|---|
| status: | new → closed |
Changed January 31, 2011 04:08PM UTC by comment:4
| component: | unfiled → ajax |
|---|---|
| priority: | undecided → low |
Changed June 17, 2011 02:13PM UTC by comment:5
http://stackoverflow.com/questions/6386884/sending-post-message-with-ajax-problem
Still there is some problem I guess.
Changed April 13, 2012 10:08PM UTC by comment:6
setRequestHeader() does not work at all. How can it be a low priority?
Hi,
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() { $.ajax({ type : 'POST', data : '', url : '/a-valid-url', success : function(data){ alert(data); }, error : function(data) { alert(data); } }); });