繁体   English   中英

剃刀中的Ajax调用Web服务

[英]Ajax call to web services in razor

这是我的网络服务电话:

 <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进行的网络服务调用:

  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..");
            }
        });
    });
});

在这里,iam将“ value and key”作为“ upload”的参数传递,但是代码未返回“ success”或“ failure”警报消息,而且iam没有收到任何错误。.我怎么知道该服务方法被调用? 或iam在代码内缺少某些内容。

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

可能是调用该服务失败,但是由于错误的错误处理程序,您将无法捕获该服务。

更改failure: error:

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM