代码之家  ›  专栏  ›  技术社区  ›  Wes

jquery ajax get请求-无法查看返回的数据

  •  3
  • Wes  · 技术社区  · 15 年前

    我想我遗漏了一些明显的东西,但我想不出来。我希望下面的HTML通知服务器的响应。但是,警报是空的。我可以在Wireshark中看到预期的响应正从服务器返回给我。为什么它不填充在数据变量中?

    <html>
    <head>
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
    </head>
    <body>
    <script type="text/javascript">
      $.get("http://www.geocommunicator.gov/TownshipGeocoder/TownshipGeocoder.asmx/GetTRS",
            {'Lat': 41,
             'Lon': -93,             
             'Units': 'eDD',
             'Datum': ''},      
            function(data) {
                alert('data:'+data);
            });
    </script>
    </body>
    </html>
    
    1 回复  |  直到 15 年前
        1
  •  1
  •   x1a4    15 年前

    跨现场保护。

    您需要使用jsonp。