English 中文(简体)
JQuery 电话XML网络服务
原标题:JQuery calling XML webservice

I m试图利用网络服务进行分类,并在从美国机场开放Xml服务。

http://services.faa.gov/airport/status/IAD?format=application/xml”rel=“nofollow” http://services.faa.gov/airport/status/IAD?format=application/xml

和我的《金字典》如下,但当页装上时,显示一个空洞的屏幕:有人可以指导我。 我在网上搜索了数据。

<html>
<head>
    <script type="text/javascript" src="assets/jquery.js"></script>
    <title>Aviation</title>
    <script type="text/javascript">
        $(document).ready(function () {
        $.ajax({
        type: "GET",
        url: "http://services.faa.gov/airport/status/IAD?format=application/xml",
        dataType: "xml",
        success: xmlParser
        });
    });

    function xmlParser(xml) {

        $( #airport ).fadeOut();
        $(xml).find("AirportStatus").each(function () {
        $("#details").append($(this).find("ICAO").text() + "</br>"+ $(this).find("State").text());
        //$(".book").fadeIn(1000);
        });
    }
    </script>
</head>
<body>
    <p id="airport">Loading...</p>
    <p id="details"></p>
</body>
</html>

提前感谢您。

最佳回答

http://en.wikipedia.org/wiki/Cross-Origin_Resource_Sharing”rel=“nofollow” 此外,Xml似乎有一些格式问题与<代码>Type:jsonp 一起尝试json格式。

$.ajax({
        type: "GET",
        url: "http://services.faa.gov/airport/status/IAD?format=json",
        dataType: "jsonp",
    success: function(data){
        alert("asd");
    console.log(data);
    }
        });

http://jsfiddle.net/WxMXR/7/

问题回答

FYI

服务器机面返回xml和回复:头盔-Type=应用/xml,应为文本/xml。

低水平的XMLHttpRequest, 采用申请/xml, 以便发生冲突。





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签