解决方案 »

  1.   


    <html>
    <head>
    <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
    <script type="text/javascript">
    // new Ajax.Request("http://ip.taobao.com/service/getIpInfo.php?ip=我的ip", { 
    //    method: "get", 
    //    onSuccess: function(data) { 
    //      var json = data.responseText.evalJSON(); 
    //  document.write(json.code); 
    //    } 
    //   });
    // $.getJSON('http://ip.taobao.com/service/getIpInfo.php?ip=我的ip', function(data) {
    //      document.write(data['data.ip']);
    //  });
    $.ajax({
            type : "GET",
            url : "http://ip.taobao.com/service/getIpInfo.php?ip=我的ip",
            dataType : "json",
            success : function (data) {
             var json=eval("("+data+")");
             document.write(json['code']);
             }
         });
    </script>
    </head>
    <body>
    </body>
    </html>
      

  2.   

    代码有错没有啊  XMLHttpRequest cannot load http://ip.taobao.com/service/getIpInfo.php?ip=我的ip. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.这个是控制器报的错 怎么解决啊 求大神 跪求
      

  3.   

    跨域了,后台做个页面下载那些数据,ajax访问那个页面获取数据