我试图用get脚本调用google map api,然后用getscript调用bmap脚本,然后将bmap函数添加到同一个脚本中。这就是我试图调用谷歌地图 api 和 bmapsc 的方式
$.getScript("http://maps.google.co.uk/maps?
file=api&v=2&async=2&callback=placeMap&key=my_API_key");
$.getScript("http://www.klossal.com/js/bmap/jQuery.bMap.1.3.js");
$("#map").bMap({
mapZoom: 11,
mapCenter:[51.501690392607,-0.1263427734375],
mapSidebar:"sideBar", //id of the div to use as the sidebar
markers:{"data":[
{
"lat":51.49757618329838,"lng":-0.1746654510498047,"title":"Science
Museum","body":"Exhibition Road, London SW7"
},{
"lat":51.47769451182406,"lng":-0.0009441375732421875,"title":"Royal Observatory
Greenwich","body":"Blackheath Ave, Greenwich, London SE10"
},{
"lat":51.49624032118747,"lng":-0.10857582092285156,"title":"Imperial War
Museum","body":"Lambeth, London, SE1"
},{
"lat":51.51792987720294,"lng":-0.1272869110107422,"title":"British Museum"
},{
"lat":51.495625811469374,"lng":-0.17642498016357422,"title":"Natural History
Museum","body":"Cromwell Road, London, SW7"
},{
"lat":51.50177053585362,"lng":-0.12908935546875,"title":"Churchill Museum"
}
]}
});
});
我不确定为什么这不起作用,对此的任何帮助都会很棒。