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?
IE8 and up only have the JSON
object in standards mode. So you need to make sure the document has a doctype.