Skip to main content

Bug Tracker

Side navigation

#4110 closed bug (fixed)

Opened February 10, 2009 09:52PM UTC

Closed November 18, 2009 02:41AM UTC

Last modified March 14, 2012 12:03PM UTC

beforeSend is ignored in Firefox 3 with JQuery 1.3.1

Reported by: radu3000 Owned by:
Priority: undecided Milestone: 1.3.2
Component: ajax Version: 1.3.1
Keywords: beforeSend ajax request header Cc:
Blocked by: Blocking:

I am not able to set any request headers inside beforeSend. See complete example below:




<script type="text/javascript" src="jquery.js"></script>

<script type="text/javascript">


url: "",

dataType: "jsonp",

beforeSend: function(xhr){

alert('help - i am ignored');

xhr.setRequestHeader('myCustomHeader', '100');


success: function(data){








<fieldset><legend>Loaded from an test.html file</legend>

<div id="html">






Attachments (0)
Change History (4)

Changed February 11, 2009 06:33PM UTC by radu3000 comment:1

JSONP is not using XMLHttpRequest at all - like the following post says already:

Too bad there is not enough documentation in the jQuery API.



Changed February 15, 2009 05:53PM UTC by dmethvin comment:2

resolution: → fixed
status: newclosed

I have updated the documentation to reflect the implementation. In particular, since they are implemented via a script tag the cross-domain requests do not provide an XHR object in their callbacks and do not fire beforeSend or processData.

Changed July 14, 2009 02:43AM UTC by dandv comment:3

resolution: fixed
status: closedreopened

If JSONP requests are done via <script src=>, and are not using XMLHttpRequest at all, is there a use case for providing the 'jsonp' option for jQuery.ajax?

I might be wrong, but when doing a JSONP request, there's nothing to specify to jQuery.ajax that one can't do in jQuery.getJSON. In that case, the 'jsonp' option is confusing (I came here for the same reason, that beforeSend was never called).

Changed November 18, 2009 02:41AM UTC by dmethvin comment:4

resolution: → fixed
status: reopenedclosed

This is working as documented; it's just not possible to set request headers on a jsonp request.