3

我有一个 ajax 请求,它返回一个对象但是我试图在标记的信息窗口中显示对象数据但是我收到一个错误:

错误

TypeError: a.get is not a function

Ajax 请求- 信息窗口未打开

google.maps.event.addListener(roadBlockMarker, "click", function () {
        //passing data to dialog
        $("#roadblockmarker-dialog").data("recordId", recordId);

        if (clicks) { //Double Click
            clicks = false; //reset
            clearTimeout(clicksTimeout);
            alert('Double Click');
            //send an ajax request to scheck the roadblock status in order to enable and disable buttons on dialog


            //set a reference to the marker clicked and then open the dialog for other options
            $("#roadblockmarker-dialog").dialog("option", {
                marker: this
            }).dialog("open");

        } else { //Single Click
            clicks = true;
            clicksTimeout = setTimeout(function () {
                clicks = false;
                alert('Single click');
                //do double click function here
                //Make ajax request to get infowindow data
                $.ajax({
                    type: 'GET',
                    url: 'getRoadBlockInfoWindowData.htm',
                    async: 'false',
                    cache: 'false',
                    data: {
                        roadBlockId: recordId
                    },
                    dataType: 'json'

                }).success(function (roadBlock) { //display info window here with data
                    var infowin = new google.maps.InfoWindow({
                        content: roadBlock.purpose
                    });
                    infowin.open(map, this);
                    console.log('success ' + roadBlock.purpose);


                });
            }, 300);

        }
        return false;


    });
4

1 回答 1

4

IIRC,this在包含的行上:infowin.open(map, this);不指marker.

于 2013-11-14T02:46:20.207 回答