javascript - asp.net web service and extra qouatation in json result ! -
I want to call web service method in javascript. (Asp.net 3.5)
I have detected the result with the firebug, here's the result:
{"d": "[[\" TI \ ": \ "Www \"}, {\ "TI \": \ "www1 \"}] "}
I think the correct result should look like this
{"d": [{\ "TI \": \ "www \"}, before and after the bracket, <\ "TI \": \ "www1 \"}]}
What is quote ?
// edited: In webserivce:
public class test {public test (string t) {T1 = t;} public string T1 {set; get; }} [WebMethod] [ScriptMethod (ResponseFormat = ResponseFormat.Json, UseHttpGet = true, XmlSerializeString = false)) Public String Load (String E) {List & lt; Test & gt; Post = new list & lt; Test & gt; {New Test ("www"), New Test ("www1")}; Return JsonConvert.SerializeObject (post); }
and in the JS file:
var store = new Ext.data.JsonStore ({Proxy: New Ext.data.HttpProxy ({url: '/core/webservice/service.asmx/Load', method: 'GET', header: {'content-type': 'application / json'}}, root: 'd', id: 'id', field : ['TI']}); Store.load ({params: {e: '}}}); Return;
Thanks.
Mir
You will not need to manually sort the web service ; Instead, consider doing something like this:
Public list & lt; Test & gt; Load (string e) {list & lt; Test & gt; Post = new list & lt; Test & gt; {New Test ("www"), New Test ("www1")}; Post of return; }
Since you are using string
as your return object, it will be sorted by you (once again) as it is Will change
Comments
Post a Comment