0

我正在尝试从公共网络服务http://www.cbr.ru/DailyInfoWebServ/DailyInfo.asmx?WSDL获取任何数据, 但它出了点问题。每次我收到“0 错误”失败警报消息。有人可以帮忙吗?

<!DOCTYPE html>
<html>
<head>
  <script src="Scripts/jquery-1.8.3.min.js"></script>
</head>
<body>
<input type="button" id="hello" value="Get data."/>
<script>
    $("#hello").click(function () {
                $.support.cors = true;
                $.ajax({
                type: "POST", 
                url: "http://www.cbr.ru/DailyInfoWebServ/DailyInfo.asmx/EnumValutes",
                data: "{Seld : False}",
                datatype: "xml",
                success: function (msg)
                {
                   Successfullcalling(msg);
                },
                error: Failurecalling
            });
    });

    function Successfullcalling(res)
    {
        alert("Done!");
    }
    function Failurecalling(res)
     {
       alert(res.status + ' ' + res.statusText);
     } 
</script>

</body>
</html>
4

2 回答 2

2

我认为问题是跨域请求。您在哪个域上编写脚本?

于 2012-11-26T11:30:09.770 回答
0

正如鲍里斯在回复中所说,这是跨域请求的问题

看看这个

jQuery Ajax - 状态码 0?

于 2012-11-26T11:40:46.177 回答