0

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>
neuDev33
  • 1,573
  • 7
  • 41
  • 54

1 Answers1

0

It looks to me like your webservice is actually returning JSON wrapped in XML.

This thread may help:

ASP.NET JSON web service always return the JSON response wrapped in XML

Community
  • 1
  • 1
E.J. Brennan
  • 45,870
  • 7
  • 88
  • 116