我想在javascript中执行类似的操作:
var latLngMatches = Gmaps4rails.geocode(address);
...
这在嵌入式JavaScript中无效。事实上,如果
我进入Chrome控制台并输入Gmaps4Rails
javascript中的对象没有函数geocode
(请参见下文)。
问题:有没有办法调用Gmaps4rails.geocode(address)
在javascript内?
JAVASCRIPT CONSOLE输出:
function Gmaps4Rails() {
this.map = null;
this.visibleInfoWindow = null;
this.userLocation = null;
this.geolocationFailure = function() {
return false;
};
this.callback = function() {
return false;
};
this.customClusterer = function() {
return false;
};
this.infobox = function() {
return false;
};
this.jsTemplate = false;
this.default_map_options = {
id: 'map',
draggable: true,
detect_location: false,
center_on_user: false,
center_latitude: 0,
center_longitude: 0,
zoom: 7,
maxZoom: null,
minZoom: null,
auto_adjust: true,
auto_zoom: true,
bounds: [],
raw: {}
};
this.default_markers_conf = {
title: "",
picture: "",
width: 22,
length: 32,
draggable: false,
do_clustering: false,
randomize: false,
max_random_distance: 100,
list_container: null,
offset: 0,
raw: {}
};
this.markers = [];
this.boundsObject = null;
this.polygons = [];
this.polylines = [];
this.circles = [];
this.markerClusterer = null;
this.markerImages = [];
}