skip to Main Content

Jquery ajax – If an AJAX REST API succeeds or fails, how do I access the request headers within the success or error callbacks?

For example, I have: $.ajax({ type: 'POST', url: 'https://jsonplaceholder.typicode.com/todos', data: { name: 'random name' }, headers: { 'x-my-custom-header': 'XYZ' }, success: function(successResp) { console.log(successResp); }, error: function(errorResp){ console.log(errorResp); } }); How can I access 'x-my-custom-header' from the request header within success…

VIEW QUESTION
Back To Top
Search