Question

I have an ajax request which returns an object however i am trying to display the objects data in an infowindow for the marker however i am getting an error:

Error

TypeError: a.get is not a function

Ajax request - the info window is not opening

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;


    });
Was it helpful?

Solution

IIRC, this on the line containing: infowin.open(map, this); doesn't refer to a marker.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top