SO - 20356374

by Arun P Johny

HTML

<button>Test</button>

JavaScript

$(document).ajaxSend(function (event, jqxhr, settings) {
    jqxhr.setRequestHeader('custom', 'new-value')
});

$('button').click(function () {
    $.ajax({
        url: '/echo/html/',
        type: 'POST',
        data: {
            html: 'content'
        }
    })
})