I have a webmethod that returns a Hashtable through a jQuery ajax call along the lines of:
$.ajax({
type: "POST",
url: webMethod,
data: {}
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(json){
**alert(json.d);**
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
alert(textStatus);
}
});
My problem is, when I deploy it to the server json.d is undefined, but instead json is the hashtable. On my local box its the opposite json.d is the hastable and not the json object.
I’ve traced it back to a point where I can see that the returned JSON string is sometimes {d:{}} and on the server its {}.
Does anybody know why?
Turns out this depends on the .net framework version your using. If your using 3.5 they add the Json.d variable as a security measurement. If you using framework 3.0 it does not appear.