jquery WebService 响应XML / 响应文本
我通过 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否检查过 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"
.