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>

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.