首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Ajax >

jQuery .ajax 跨域读百度数据,有人能做出来吗,解决办法

2013-08-01 
jQuery.ajax 跨域读百度数据,有人能做出来吗,急! 地址是这个http://api.map.baidu.com/place/v2/search?&q

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();

热点排行