Using $.getJSON() to visit cross domain resources.
This commit is contained in:
14
index.html
14
index.html
@@ -20,14 +20,10 @@ body, html,#allmap {width: 100%;height: 100%;overflow: hidden;margin:0;}
|
|||||||
var map = new BMap.Map("allmap"); // 创建Map实例
|
var map = new BMap.Map("allmap"); // 创建Map实例
|
||||||
map.centerAndZoom("上海",15); // 初始化地图,设置中心点坐标和地图级别。
|
map.centerAndZoom("上海",15); // 初始化地图,设置中心点坐标和地图级别。
|
||||||
|
|
||||||
$.ajax({
|
// https://github.com/unixcrh/DOUBANTONGCHENG/blob/master/DouBanTongCheng/ContentVC.m
|
||||||
url: "http://api.douban.com/event/location/shanghai?type=exhibition&max-results=50",
|
$.getJSON("https://api.douban.com/v2/event/list?loc=shanghai&type=exhibition&max-results=50&callback=?", function(result){
|
||||||
})
|
//response data are now in the result variable
|
||||||
.done(function( response ){
|
console.log(result);
|
||||||
console.log("received", response);
|
});
|
||||||
})
|
|
||||||
.fail(function() {
|
|
||||||
alert("无法访问豆瓣同城API!");
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user