I'm calling a web service via an ajax call that looks like -
$.ajax({
cache: false,
type: 'POST',
url: 'renderDisplay.asmx/displayElements',
dataType: 'json',
data: object,
success: function () {
alert ("success"); },
error: function (response) {
alert("error: " + response.responseText);}
});
My Web Service function -
JavaScriptSerializer serializer = new JavaScriptSerializer();
Dictionary<string, string> temp = new Dictionary<string, string>();
temp.Add("boston", "mass");
string json = serializer.Serialize((object)temp);
return json;
The error I get -
Note: The opening brackets "<" have been put in parenthesis because otherwise the 2 lines are taken as actual code
error: (<)?xml version="1.0" encoding="utf-8"?>
(<)string xmlns="http://tempuri.org/">{"boston":"mass"}</string>