两种方式:一种是用js原声方法实现,一种是利用jquery框架实现
json数据是urlJavaScriptJSON

解决方案 »

  1.   

    你 url 是什么
    是否涉及到跨域 url是否支持跨域
      

  2.   

    你 url 是什么
    是否涉及到跨域 url是否支持跨域url是:http://fxinfo.api.fxhelper.cn/news/bignewnews.js
      

  3.   

    你网站的还是别人的?比人的需要做代理看这个http://bbs.csdn.net/topics/390526928
      

  4.   

    jQuery.support.cors = true;
    var url='http://fxinfo.api.fxhelper.cn/news/bignewnews.js';
    var str="";
    $.getJSON(url,function(json){
    var n=json.length;
    for(var i=0;i<n;i++){
    str += "<div>" + json[i].Value.strfrom + "</div>";
    }
    document.getElementById('msg').innerHTML=str;
    })
      

  5.   

      $.getJSON("test.aspx", function (json) {
            alert(json[0].Key);
        });test.aspx
    using System.Net;
     string str="";
            string url = "http://fxinfo.api.fxhelper.cn/news/bignewnews.js";        using (WebClient client = new WebClient())
            {
                client.Encoding = System.Text.UTF8Encoding.UTF8;
                str= client.DownloadString(url);
                       
            }
     Response.Write(str);
            Response.End();
      

  6.   

    不用回调么?我写了个看下<!doctype html>
    <html xmlns="http://www.w3.org/1999/xhtml" > 
    <head>
    <meta charset="utf-8">
    <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.0.js"></script>
    <script type="text/javascript">
    $(document).ready(function(){
    $("button").click(function(){
    $.getJSON("http://fxinfo.api.fxhelper.cn/news/bignewnews.js?callback=?",function(data){
    var s="";
    $.each(data, function(i, item){
    s +=item["go"]+"<br>";
    });
    $("#go").html(s);
        });
      });
    });
    </script>
    </head><body>
    <button>开始</button>
    <div id="go">
    </div></body>
    </html>
      

  7.   

    不用回调么?我写了个看下<!doctype html>
    <html xmlns="http://www.w3.org/1999/xhtml" > 
    <head>
    <meta charset="utf-8">
    <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.0.js"></script>
    <script type="text/javascript">
    $(document).ready(function(){
    $("button").click(function(){
    $.getJSON("http://fxinfo.api.fxhelper.cn/news/bignewnews.js?callback=?",function(data){
    var s="";
    $.each(data, function(i, item){
    s +=item["go"]+"<br>";
    });
    $("#go").html(s);
        });
      });
    });
    </script>
    </head><body>
    <button>开始</button>
    <div id="go">
    </div></body>
    </html>引用完JQuery后记得加一条
    jQuery.support.cors = true;
    允许跨站
      

  8.   

    不用回调么?我写了个看下<!doctype html>
    <html xmlns="http://www.w3.org/1999/xhtml" > 
    <head>
    <meta charset="utf-8">
    <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.0.js"></script>
    <script type="text/javascript">
    $(document).ready(function(){
    $("button").click(function(){
    $.getJSON("http://fxinfo.api.fxhelper.cn/news/bignewnews.js?callback=?",function(data){
    var s="";
    $.each(data, function(i, item){
    s +=item["go"]+"<br>";
    });
    $("#go").html(s);
        });
      });
    });
    </script>
    </head><body>
    <button>开始</button>
    <div id="go">
    </div></body>
    </html>引用完JQuery后记得加一条
    jQuery.support.cors = true;
    允许跨站

    不是所有浏览器都支持
    jQuery.support.cors = true; 
      

  9.   

    不用回调么?我写了个看下<!doctype html>
    <html xmlns="http://www.w3.org/1999/xhtml" > 
    <head>
    <meta charset="utf-8">
    <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.0.js"></script>
    <script type="text/javascript">
    $(document).ready(function(){
    $("button").click(function(){
    $.getJSON("http://fxinfo.api.fxhelper.cn/news/bignewnews.js?callback=?",function(data){
    var s="";
    $.each(data, function(i, item){
    s +=item["go"]+"<br>";
    });
    $("#go").html(s);
        });
      });
    });
    </script>
    </head><body>
    <button>开始</button>
    <div id="go">
    </div></body>
    </html>引用完JQuery后记得加一条
    jQuery.support.cors = true;
    允许跨站

    不是所有浏览器都支持
    jQuery.support.cors = true; 我写的对吗?有问题么?我的看不了啊
      

  10.   

    不支持 jsonp 所以你要用 在7楼给你的方法啊不是所有浏览器都支持
    jQuery.support.cors = true; 
      

  11.   

    不支持 jsonp 所以你要用 在7楼给你的方法啊不是所有浏览器都支持
    jQuery.support.cors = true; 我知道不是所有的浏览器都支持,但是我写的也是有问题的,你知道怎么改么?
      

  12.   

    不支持 jsonp 所以你要用 在7楼给你的方法啊不是所有浏览器都支持
    jQuery.support.cors = true; 我知道不是所有的浏览器都支持,但是我写的也是有问题的,你知道怎么改么?楼主很是坚持啊<html xmlns="http://www.w3.org/1999/xhtml" > 
    <head>
    <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.0.js"></script>
    <script type="text/javascript">
    jQuery.support.cors = true;
    $(document).ready(function () {
        $("button").click(function () {
            $.getJSON("http://fxinfo.api.fxhelper.cn/news/bignewnews.js", function (data) {
                var s = "";
              
                $.each(data, function (i, item) {
                    s += item.Value["strtitle"] + "<br>";
                });
                $("#go").html(s);
            });
        });
    });
    </script>
    </head><body>
    <button>开始</button>
    <div id="go">
    </div></body>
    </html>
      

  13.   

    不支持 jsonp 所以你要用 在7楼给你的方法啊不是所有浏览器都支持
    jQuery.support.cors = true; 我知道不是所有的浏览器都支持,但是我写的也是有问题的,你知道怎么改么?楼主很是坚持啊<html xmlns="http://www.w3.org/1999/xhtml" > 
    <head>
    <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.0.js"></script>
    <script type="text/javascript">
    jQuery.support.cors = true;
    $(document).ready(function () {
        $("button").click(function () {
            $.getJSON("http://fxinfo.api.fxhelper.cn/news/bignewnews.js", function (data) {
                var s = "";
              
                $.each(data, function (i, item) {
                    s += item.Value["strtitle"] + "<br>";
                });
                $("#go").html(s);
            });
        });
    });
    </script>
    </head><body>
    <button>开始</button>
    <div id="go">
    </div></body>
    </html>
    那个http://fxinfo.api.fxhelper.cn/news/bignewnews.js后面不用加?callback=?吗?
      

  14.   

    不支持 jsonp 所以你要用 在7楼给你的方法啊不是所有浏览器都支持
    jQuery.support.cors = true; 我知道不是所有的浏览器都支持,但是我写的也是有问题的,你知道怎么改么?楼主很是坚持啊<html xmlns="http://www.w3.org/1999/xhtml" > 
    <head>
    <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.0.js"></script>
    <script type="text/javascript">
    jQuery.support.cors = true;
    $(document).ready(function () {
        $("button").click(function () {
            $.getJSON("http://fxinfo.api.fxhelper.cn/news/bignewnews.js", function (data) {
                var s = "";
              
                $.each(data, function (i, item) {
                    s += item.Value["strtitle"] + "<br>";
                });
                $("#go").html(s);
            });
        });
    });
    </script>
    </head><body>
    <button>开始</button>
    <div id="go">
    </div></body>
    </html>

    非常感谢大神,但是我还是想知道为什么要加.Value["strtitle"]?这是什么意思啊?还有那个为什么不用加?callback=?回调呢?
      

  15.   

    不支持 jsonp 所以你要用 在7楼给你的方法啊不是所有浏览器都支持
    jQuery.support.cors = true; 我知道不是所有的浏览器都支持,但是我写的也是有问题的,你知道怎么改么?楼主很是坚持啊<html xmlns="http://www.w3.org/1999/xhtml" > 
    <head>
    <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.0.js"></script>
    <script type="text/javascript">
    jQuery.support.cors = true;
    $(document).ready(function () {
        $("button").click(function () {
            $.getJSON("http://fxinfo.api.fxhelper.cn/news/bignewnews.js", function (data) {
                var s = "";
              
                $.each(data, function (i, item) {
                    s += item.Value["strtitle"] + "<br>";
                });
                $("#go").html(s);
            });
        });
    });
    </script>
    </head><body>
    <button>开始</button>
    <div id="go">
    </div></body>
    </html>

    非常感谢大神,但是我还是想知道为什么要加.Value["strtitle"]?这是什么意思啊?还有那个为什么不用加?callback=?回调呢?
    那个为什么加.Value["strtitle"]我知道了 ,但是那个为什么不用加?callback=?我还是不明白?
    还有用js原生方法,该怎么做呢?可以提分