Question

I am trying log json data onto console using following code and I want to debug it using developers tool provided by IE.

My Code is

$.getJSON("s13.aspx", function (data3, textStatus3) {
                     console.log(textStatus3);}

But I am having error that console is undefined.

Why is it happening? How to solve it?

Was it helpful?

Solution 2

console doesn't exist in IE unless the console is actually open

check this link for a detailed discussion:

Internet Explorer: "console is not defined" Error

to check whether console is defined or not, you can do

if ('console' in window)

OTHER TIPS

Use if(window.console) first.

if( window.console ){
   console.log('hi');
}else{
   alert('console not avaliable');
}

https://developer.mozilla.org/en-US/docs/Web/API/console

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top