-1

I am doing an AJAX call and attempting to retrieve the response headers.

MY code:

 var xmh = new XMLHttpRequest;
 xmh.getAllResponseHeaders

I am trying to view the headers in the console and what I am getting back is '[native code]'. Please could someone advise me on how to view the headers? This question is specific and not a generalised one like the proposed solutions that someone has mentioned as a duplicate.

dave
  • 475
  • 6
  • 17
  • 2
    Possible duplicate of [console.log javascript \[Function\]](http://stackoverflow.com/questions/9460826/console-log-javascript-function) – Sterling Archer Oct 13 '16 at 17:19

1 Answers1

0

This is because you are inspecting the function itself, whereas you want to first invoke the function, and then inspect it's return value.

Try updating to:

xmh.getAllResponseHeaders();
lux
  • 8,315
  • 7
  • 36
  • 49