Reputation:
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?
Upvotes: 2
Views: 2797
Reputation: 13917
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)
Upvotes: 1
Reputation: 2919
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
Upvotes: 2