Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 当asmx web服务返回时,我的JSON被包装成xml?_Jquery_Asp.net_Json_.net 3.5 - Fatal编程技术网

Jquery 当asmx web服务返回时,我的JSON被包装成xml?

Jquery 当asmx web服务返回时,我的JSON被包装成xml?,jquery,asp.net,json,.net-3.5,Jquery,Asp.net,Json,.net 3.5,不幸的是,客户端只支持VS2008(框架3.5),不知道为什么我的json被包装成xml。使用webforms 我的JSON返回: <?xmlversion="1.0"encoding="utf-8"?><stringxmlns="http://tempuri.org/">[ { "Name": "AAA", "Company": "AAAA", "Address": "AAAA", "Phone":

不幸的是,客户端只支持VS2008(框架3.5),不知道为什么我的json被包装成xml。使用webforms

我的JSON返回:

<?xmlversion="1.0"encoding="utf-8"?><stringxmlns="http://tempuri.org/">[
    {
        "Name": "AAA",
        "Company": "AAAA",
        "Address": "AAAA",
        "Phone": "1204675",
        "Country": "US"
    },
    {
        "Name": "AAAA",
        "Company": "AAAA",
        "Address": "AAAA",
        "Phone": "AAA",
        "Country": "AAA"
    }
]</string>

这可能会对您有所帮助:我的问题没有解决方案。是否包括相关的web.config部分?
[WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    [System.Web.Script.Services.ScriptService]
    public class HCTCService : System.Web.Services.WebService
    {

        [WebMethod]
        [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
        public string TestJSON()
        {
            Employee[] e = new Employee[2];
            e[0] = new Employee();
            e[0].Name = "AAA";
            e[0].Company = "AAAA";
            e[0].Address = "AAAA";
            e[0].Phone = "1204675";
            e[0].Country = "US";
            e[1] = new Employee();
            e[1].Name = "AAAA";
            e[1].Company = "AAAA";
            e[1].Address = "AAAA";
            e[1].Phone = "AAA";
            e[1].Country = "AAA";
            return new JavaScriptSerializer().Serialize(e);
        }

    }
}