Jquery 谷歌地图信息窗口的外部链接

Jquery 谷歌地图信息窗口的外部链接,jquery,google-maps,google-maps-api-3,Jquery,Google Maps,Google Maps Api 3,我有一个GoogleMaps设置,其中数据来自mySql后端,并以编码字符串的形式存储。 我可以正确显示地图中的数据,但无法提供外部链接 for (x = 0; x < stringArray.length; x = x + 1) { var addressDetails = []; var marker; //Separate each field addressDetails = stringArray[x

我有一个GoogleMaps设置,其中数据来自mySql后端,并以编码字符串的形式存储。 我可以正确显示地图中的数据,但无法提供外部链接

    for (x = 0; x < stringArray.length; x = x + 1)
    {
        var addressDetails = [];
        var marker;
        //Separate each field
        addressDetails = stringArray[x].split("&&&");
        //Load the lat, long data
        var lat = new google.maps.LatLng(addressDetails[1], addressDetails[2]);
        //Create a new marker and info window
        var y = x+1;
        marker = new google.maps.Marker({
            map: map,
            position: lat,
            content: addressDetails[0],
            icon: 'http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld='+y+'|FF0000|000000'
        });
        //Pushing the markers into an array so that it's easier to manage them
        markersArray.push(marker);

        google.maps.event.addListener( marker, 'click', function () {
            closeInfos();
            var info = new google.maps.InfoWindow({content: this.content});
            //On click the map will load the info window
            info.open(map,this);
            infos[0]=info;
        });
       //Extends the boundaries of the map to include this new location
       bounds.extend(lat);
    }
    //Takes all the lat, longs in the bounds variable and autosizes the map
    map.fitBounds(bounds);
我得到的错误是: “未捕获引用错误:未定义myclick”

请告诉我哪里出错了


谢谢,

鉴于您试图调用
myclick
的方式,您需要将其附加到
窗口
对象:

window.myclick = function(i) {
    console.log('I am defined and available in the global scope via window!');
}

.

鉴于您试图调用
myclick
的方式,您需要将其附加到
窗口
对象:

window.myclick = function(i) {
    console.log('I am defined and available in the global scope via window!');
}

.

如有任何帮助,我们将不胜感激。您将绑定
myclick
到哪里?对不起,我没有接到您的电话。你的意思是,我在哪里调用事件?在你的第一段代码中,没有任何东西注册你的
myclick
处理程序。鉴于您的错误,您似乎正在将其绑定到一个作用域中,并试图从另一个作用域调用它,但没有看到事件处理程序注册,我只是猜测。我将快速创建一个fiddle并通知您,URLAny帮助将不胜感激。您在哪里绑定
myclick
?对不起,我没有理解您。你的意思是,我在哪里调用事件?在你的第一段代码中,没有任何东西注册你的
myclick
处理程序。鉴于您的错误,看起来您正在将其绑定到一个作用域并尝试从另一个作用域调用它,但没有看到事件处理程序注册,我只是在猜测。我将快速创建一个fiddle并让您知道URL