Using IE 8/VS 2010/IIS on Server 2008
Developing a web app in my local instance of VS2010, in testing everything performs ‘as expected’; Deployed to Server; testing (also from the same local machine using ‘the same’ IE 8)
Getting a client side error:”Error: ‘JSON’ is undefined”, referencing a JS file and following line:
function getOrderData() {
$.ajax({
type: "POST",
url: "order.aspx/GetOrderData",
data: JSON.stringify({ "OrderID": $(".hdnOrdID").val() }),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: showDefaultOrderData,
error: showErrorMessage
});
}
I believe the error message is referencing the call to "JSON.stringify({.... (but could be mistaken…)
Application performs as expected in FireFox.
So, my application works as expected in IE8 when launched from VS2010
and when using FireFox against the server. But IE gives me a client side (js) error only when the call is made to server.
What can make the JSON reference unavailable to IE under these conditions?
[or, what am I missing here?]
Try taking IE8 out of compatibility mode.
Also, uncheck the “Display Intranet sites in Compatibility Mode” settings under tools (as recommended by O.P.)