Last Updated: February 25, 2016
·
1.218K
· dakuan

AJAX request headers

It's possible to mess about with the headers of you AJAX requests. With jQuery you can do this:

var deferred = $.ajax({
                    ....
                  beforeSend: (xhr) ->
                    xhr.setRequestHeader('Content-Type', 'application/json')
});

I had to do this to get the Google url shortening service to work...

more documentation

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Did you know?

JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.

Security insights from Cside