web services - Web method response format in Mono2.0.1 -


I wrote a [WebMethod] that returns a string that stores the serialized object

  [WebMethod] Public string doStuffs () {... Javascript convert back. SerializeObject (myObj); // JSON Serializer Library for JSON.NET 1.3.1, Mono}  

When I call method from JQuery with $ .post:

 < Code> $ AJAX ({type: "post", url: "/ web / dustfuse", data: "{}", content type: "app / jason; charset = utf-8", datatype: "jason", success: function Msg) {// what stuff}});  

The answer to the problem is what I get here:

  & lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; String xmlns = "http: // localhost: 8080 / papi" & gt; {"Field1": "value1", "field2:" value2 ", etc. etc.}}   

Why has JSON response inside an XML been explained? I can see the header (incorrectly?):

  content-type text / xml; charset = utf-8  

How do I change? Thank you.

If I do:

  $ ("/ Web / doStuffs", {user name: $ ("username") .val ()}, function (data) {var obj = $ (data). Child ();}, "xml") ;  

I have JSON in JSON which is ready to parse JS. It should work well.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -