Javascript jquerycookie+;谷歌地图api 3 latlng
我有这个javascriptJavascript jquerycookie+;谷歌地图api 3 latlng,javascript,Javascript,我有这个javascript if ( $.cookie("latlng") ) { myLatlng = new google.maps.LatLng( $.cookie("latlng") ); //problem here?? } else { $.cookie("latlng", "0,0", { path: '/' }); myLatlng = new google.maps.LatLng(0,0); } cookie函数正在使用 我的问题是如何将
if ( $.cookie("latlng") ) {
myLatlng = new google.maps.LatLng( $.cookie("latlng") ); //problem here??
} else {
$.cookie("latlng", "0,0", { path: '/' });
myLatlng = new google.maps.LatLng(0,0);
}
cookie函数正在使用
我的问题是如何将cookie的值传递给google.maps.LatLng
提前谢谢 我不确定信息是如何存储在cookie中的,但据我所知,
google.maps.LatLng
需要两个参数,而且看起来您只给了它一个参数
尝试这样做:
if ($.cookie('latlng')) {
myLatlng = $.cookie('latlng').split(',');
myLatlng = new google.maps.LatLng(myLatlng[0], myLatlng[1]);
}