Dan G. Switzer, II schrieb:
They should already be able to do that with the beforeSend option[1][2],
but your way looks easier

[1] http://docs.jquery.com/Ajax#Options
[2] http://dev.jquery.com/browser/trunk/jquery/src/ajax/ajax.js#L644

One other benefit with my change, is you could get rid of this line:

637     // Set header so the called script knows that it's an XMLHttpRequest
638     xml.setRequestHeader("X-Requested-With", "XMLHttpRequest");

And replace it with:

462     ajaxSettings: {
463       global: true,
464       type: "GET",
465       timeout: 0,
466       contentType: "application/x-www-form-urlencoded",
467       processData: true,
468       async: true,
469       data: null,
470       headers: {"X-Requested-With": "XMLHttpRequest"}
471     },
Now you have to explicitly extend the headers object to add additional global headers. Otherwise you'd overwrite the x-requested-with header, and that could be really hard to find.

--
Jörn Zaefferer

http://bassistance.de

Reply via email to