Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2008/2.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
C# 在jQuery上接收数据集(xml)_C#_Javascript_Jquery_Web Services - Fatal编程技术网

C# 在jQuery上接收数据集(xml)

C# 在jQuery上接收数据集(xml),c#,javascript,jquery,web-services,C#,Javascript,Jquery,Web Services,我在jQuery中有这个连接到我的Web服务的示例代码 发送文本和接收文本。它的工作非常出色 <html lang="en-US"> <head> <meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8" /> <meta name="viewport" content="width=device-width" /

我在jQuery中有这个连接到我的Web服务的示例代码

发送文本和接收文本。它的工作非常出色

<html  lang="en-US">
    <head>
        <meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8" />
        <meta name="viewport" content="width=device-width" />
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
        <script type="text/javascript">

            //var WS_URI = 'http://10.0.0.5/WS_Catalog_SQL/Service1.asmx/GetItem';    
            var WS_URI = 'http://10.0.0.5/WS_Catalog/Service1.asmx/GetItem';   
            var MAKAT ;

            function Look() {
                MAKAT = document.getElementById("txt").value.toString();
                $.ajax({
                    ServiceCallID: 1,
                    url: WS_URI,
                    type: 'POST',
                    data: '{"Makat": "' + MAKAT + '"}',
                    contentType: 'application/json; charset=utf-8',
                    dataType: 'json',
                    success:
                        function (data, textStatus, XMLHttpRequest) {
                            //document.writeln(data.d);
                            $("#RES").text((data.d).toString());
                        },
                    error:
                  function (XMLHttpRequest, textStatus, errorThrown) {
                      alert(textStatus);
                  }
                });
            }
    </script>
    </head>

    <body >
          <br />
          <button onclick="Look();">Press me</button>
          <input id="txt"  value="1111"/>
          <br />
          <p id="RES">res</p>
    </body>
</html>
现在我需要接收数据集(xml)

我构建了接收文本和发送数据集的WebService(用C语言)

但是jQuery不起作用

我试试这个:

contentType: "text/xml",
dataType: "text",
得到了这个错误:

POST http://10.0.0.5/WS_Catalog_SQL/Service1.asmx/GetItem 500 (Internal Server Error) jquery.min.js:130
c.extend.ajax jquery.min.js:130
Look (index):14
onclick

我伤了两天的脑筋,似乎找不到解决方案……

尝试更改请求对象的数据类型:

contentType: "text/xml",
dataType: "text",

它以什么方式不起作用?描述您期望发生的事情和实际发生的事情,以及您迄今为止尝试过的事情。我尝试了:contentType:“text/xml”,dataType:“text”,-但是我遇到了错误,函数进入了错误:sectionjQuery运行您的错误回调,因为500是一个错误代码。这不是一个bug,这是一个功能。谢谢,如何解决它?对于初学者,您可以指定
console.log
作为错误回调,以打印控制台中的所有参数,以及使用开发人员工具(如Firebug或Chrome dev工具)检查请求。感谢帮助,我尝试了这个方法,但我遇到了错误。我附加了WebService代码这是内部服务器错误,即可能是您的服务崩溃。你试过调试你的webmethod吗?
contentType: "text/xml",
dataType: "text",