Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

0x800a1391 - JavaScript runtime error: 'JSON' is undefined in IE 10

I'm using IE 10 Compatibility on Windows 8, I'm getting this error while running the WebApp in Debug mode(VS 2012). 0x800a1391 - JavaScript runtime error: 'JSON' is undefined Code below

var data = JSON.stringify(GetUserDetails());

function GetUserDetails() {
    var userData = {};
    userData.userName = $('#txtUserName').val();
    userData.password = $('#txtPassword').val();
    return userData;
}

Also , the strange fact is the same code hosted in IIS 8 runs fine in IE 10 Browser. Any inputs?

like image 557
Rameez Ahmed Sayad Avatar asked Mar 12 '13 11:03

Rameez Ahmed Sayad


1 Answers

IE8 and up only have the JSON object in standards mode. So you need to make sure the document has a doctype.

like image 114
T.J. Crowder Avatar answered Oct 26 '22 15:10

T.J. Crowder