天天看点

$.getJSON()跨域请求

1,同一域名下和其他的请求可以是一样的

js:

        var url="http://localhost:2589/a.ashx";

        $(function(){

            $.getJSON(url,function(data){

                alert (data.Name);

            })

        });

 服务器返回字符串:

{"Name":"loogn","Age":23}

 2,不同域名下 

js: 

       var url="http://localhost:2589/a.ashx?callback=?";

jQuery1706543070425920333_1324445763158({"Name":"loogn","Age":23})

继续阅读