日期:2014-05-16  浏览次数:20607 次

jQuery .ajax 跨域读百度数据,有人能做出来吗,急!
 地址是这个  http://api.map.baidu.com/place/v2/search?&q=饭店&region=北京&output=json&ak=E4805d16520de693a3fe707cdc962045
谁能做一个成功的例子给我,只要能得到数据

------解决方案--------------------
不支持 jsonp啊 。
单独建立数据抓取服务页吧
 $.getJSON("test.aspx", function (json) {
        alert(json.results[0].name);
    });

test.aspx

using System.Net;
 string str="";
        using (WebClient client = new WebClient())
        {
            client.Encoding = System.Text.UTF8Encoding.UTF8;
            str= client.DownloadString("http://api.map.baidu.com/place/v2/search?&q=%E9%A5%AD%E5%BA%97&region=%E5%8C%97%E4%BA%AC&output=json&ak=E4805d16520de693a3fe707cdc962045&callback=foo");
        }
        Response.Write(str);
        Response.End();