jquery WebService 响应XML / 响应文本

发布于 2024-08-30 21:41:28 字数 925 浏览 1 评论 0原文

我通过 jquery/ajax 从本地 WebService 调用得到一个空响应。

我已通过在浏览器中调用该调用来验证 URL 和 XML 输入字符串。 我确实按预期返回了 XML 代码。

我缺少什么?它可能与返回类型“XmlDocument”有关吗? 我尝试将 text/xml 更改为文本。没有影响。尝试使用 GET 而不是 POST。


Web服务(本地运行)

..._ 公共函数 GetXML(ByVal strXML As String) As XmlDocument... Dim retXML As XmlDocument = New XmlDocument()

...CODE....

返回 retXML


调用函数:

#

GetStat() {

var Url = 'http://localhost/myService.asmx?op=GetXML';

var 消息 = ' 55 教皇 我的用户
我的密码


';

$.ajax({
    url: Url,
    type: "POST",
    dataType: "text/xml",
    data: msg,
    complete: processResult,
    contentType: "text/xml"
});

return false;

}

函数 processResult(xmlData, 状态) { var jData = $(xmlData); }

#

谢谢!

I get an empty response back from this local WebService call via jquery / ajax.

I have verified the URL and XML input string by invoking the call in a browser.
I DO get XML code back as expected.

What am I missing? Could it have something to do with the return type "XmlDocument"?
I have tried changing out text/xml to text. No affect. Tried a GET instead of POST.


Webservice (running locally)...

_
Public Function GetXML(ByVal strXML As String) As XmlDocument...
Dim retXML As XmlDocument = New XmlDocument()

...CODE....

Return retXML


Calling Function:

#

GetStat() {

var Url = 'http://localhost/myService.asmx?op=GetXML';

var msg = '

55
POPE
myUser
myPwd

';

$.ajax({
    url: Url,
    type: "POST",
    dataType: "text/xml",
    data: msg,
    complete: processResult,
    contentType: "text/xml"
});

return false;

}

function processResult(xmlData, status) {
var jData = $(xmlData);
}

#

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

会发光的星星闪亮亮i 2024-09-06 21:41:28

您是否检查过 XML 格式是否正确

除此之外,我很确定 contentType 应该是 "xml"

Have you checked to see that the XML is well formed?

Other than that i'm pretty sure contentType should be "xml".

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文