<script>
function click_a (href) {
$.ajax({
url: href,
beforeSend: function(xhr) {
xhr.setRequestHeader("custom", "my_custom_here");
},
success: function (data, status, xhr) {
window.location = xhr.url;
}
});
};
</script>
<p><a onclick="click_a('/exemple')" href="/exemple">My_link</a></p>