【问题标题】:Jquery call to xml web serviceJquery 调用 xml Web 服务
【发布时间】:2016-01-07 11:14:10
【问题描述】:

我在尝试使用 Ajax jquery 从 Web 服务获取信息时遇到问题。我当前的代码:

$(document).ready(function () {
         CallWebService();
    });

function CallWebService() {
        var URL = "http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml";
        jQuery.ajax({
            type: "POST",
            url: URL,
            dataType: "xml",
            contentType: "application/xml; charset=utf-8",
            success: function (data) {
                console.log(data);
            }
        })
    }

当我运行此代码时,我收到以下错误:

Mixed Content: The page at 'https://fiddle.jshell.net/_display/' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml'. This request has been blocked; the content must be served over HTTPS.

知道如何让它发挥作用吗?

【问题讨论】:

    标签: jquery ajax xml web-services


    【解决方案1】:

    问题不在于代码。但这与您运行代码的方式有关。如果您正在使用任何服务器,请托管此页面(在其上编写此 js)然后运行它。出于安全考虑,您的请求被浏览器阻止。

    在托管后尝试运行此页面。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-06-18
      • 2012-04-09
      • 1970-01-01
      • 1970-01-01
      • 2011-12-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多