dave dave - 1 month ago 15
Ajax Question

javascript getAllResponseHeaders() - how to view '[native code]'?

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.

lux lux
Answer

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();