gpt4 book ai didi

javascript - Ajax 调用 Razor 中的 Web 服务

转载 作者:行者123 更新时间:2023-12-03 09:36:36 25 4
gpt4 key购买 nike

这是我的网络服务调用:

 <wsdl:operation name="upload">
<soap:operation soapAction="http://uri.org/IDA_Command/upload" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>

这是我从 javascript 进行的 Web 服务调用:

  var uploadInputs = "/Import/uploadInputs ";
$.get(uploadInputs + "/", function (data) {
$.each(data, function (value, key) {
$.ajax({
url: 'http://uri.org/IDA_Command/upload',
contentType: 'application/json; charset=utf-8',
dataType: "json",
processData: false,
type: "POST",
success: function (response) {
if (response = true) {
alert("Inputs uploading...");
}
},
failure: function (response) {
alert("There was an error in uploading the inputs..");
}
});
});
});

在这里,我将“值和键”作为“上传”的参数传递,但代码没有返回“成功”或“失败”警报消息,而且我也没有收到任何错误。我如何知道服务方法接到电话吗?或者我在代码中遗漏了一些东西。

谁能告诉我,如何使用Ajax调用服务中调用带有两个参数的上传方法?提前致谢。

最佳答案

可能调用服务时发生故障,但您无法捕获它,因为您的故障处理程序不正确。

失败:更改为错误:

error: (jqXHR, textStatus, errorThrown) { ... }

关于javascript - Ajax 调用 Razor 中的 Web 服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31317591/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com