andreas wrote:
Are custom headers (x-*) supported in the current version of Jquery ?

If not any quick workarounds ?

Didn't have time to go over the posts in the group and i would
appreciate answers/tips cause i need to deploy an app. based heavily
on async calls and custom headers will be required in many occasions.


thank you.


Well, if you don't have time to go over the posts, you should have a quick look at the docs for $.ajax instead. In the options section you'll find a beforeSend callback:

"beforeSend (Function) - A pre-callback to modify the XMLHttpRequest object before it is sent. Use this to set custom headers etc. The XMLHttpRequest is passed as the only argument."

http://docs.jquery.com/Ajax#Options

=>

$.ajax({
    ...
    beforeSend: function(xhr) {
        xhr.setRequestHeader('foo', 'bar');
    }
});


I don't remember the correct syntax for setting the request header for an instance of an XmlHttpRequest object, so setRequestHeader maybe wrong.

HTH

--Klaus



Reply via email to