Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9014055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:25:05+00:00 2026-06-16T03:25:05+00:00

I have been stuck on this for ages. I have created a map that

  • 0

I have been stuck on this for ages. I have created a map that pulls the data from a mysql database with php. Everything was fine and I was getting info windows for each marker. I added code for clustering which works fine. Now it only shows the same information box when clicking on the marker. I have tried solutions posted on this site related to my problem, but can’t seem to find a solution. Any help would be appreciated

var customIcons = {
  BB: {
    icon: '/assets/img/bb-icon.png',
    shadow: 'http://labs.google.com/ridefinder/images/mm_20_shadow.png'
  },
  SC: {
    icon: '/assets/img/sc-icon.png',
    shadow: 'http://labs.google.com/ridefinder/images/mm_20_shadow.png'
  },
  BOTH: {
    icon: '/assets/img/both-icon.png',
    shadow: 'http://labs.google.com/ridefinder/images/mm_20_shadow.png'
  }
};

function load() {
    var cluster = [];
  var map = new google.maps.Map(document.getElementById("maplocation"), {
    center: new google.maps.LatLng(<?php echo $coord; ?>),
    zoom: 9,
    mapTypeId: 'roadmap'
  });
  var infowindow = new google.maps.InfoWindow();

  // Change this depending on the name of your PHP file
  downloadUrl("/generate-coords.php?map=<?php echo $_GET['area']; ?>", function(data) {
    var xml = data.responseXML;
    var markers = xml.documentElement.getElementsByTagName("marker");
 for (var i = 0; i < markers.length; i++) {
        var name = markers[i].getAttribute("name");
        var thetitle = markers[i].getAttribute("name");
        var address = markers[i].getAttribute("address");
        var type = markers[i].getAttribute("type");
        var farmno = markers[i].getAttribute("farmno");
        var point = new google.maps.LatLng(
          parseFloat(markers[i].getAttribute("lat")),
          parseFloat(markers[i].getAttribute("lng")));
        var html = '<b>' + name + '</b> <br />' + address+ '<br /><a href="/fulldetails.php?farmno=' + farmno + '">More Details</a>';
        var icon = customIcons[type] || {};
        var marker = new google.maps.Marker({
           map: map,
           position: point,
           icon: icon.icon,
           shadow: icon.shadow,
           title:thetitle,
           content:html
          });
       google.maps.event.addListener(marker, 'click', (function(marker, i) {
                    return function() {
                        infowindow.setContent('<div style=height:80px;overflow:none>'+html+'</div>');
                        infowindow.open(map, this);
                    }
                })(marker, i));
             cluster.push(marker);
         }

        var markerClustererOptions = {   
           maxZoom: null,
           gridSize: 15 ,   
          title: 'Click to zoom in and see farms.'
         };  
    var mc = new MarkerClusterer(map,cluster,markerClustererOptions);
  });
}

function downloadUrl(url, callback) {
  var request = window.ActiveXObject ?
      new ActiveXObject('Microsoft.XMLHTTP') :
      new XMLHttpRequest;

  request.onreadystatechange = function() {
    if (request.readyState == 4) {
      request.onreadystatechange = doNothing;
      callback(request, request.status);
    }
  };

  request.open('GET', url, true);
  request.send(null);
}

function doNothing() {}`
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T03:25:07+00:00Added an answer on June 16, 2026 at 3:25 am

    Try this

    google.maps.event.addListener(marker, 'click', (function(marker, i, html) {
        return function() {
            infowindow.setContent('<div style=height:80px;overflow:none>'+html+'</div>');
            infowindow.open(map, marker);
    })(marker, i, html));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have been stuck on this problem of sharing a function from one
I have been stuck on this for hours. I have a.html on http://example.com that
I have been stuck on this for hours..I downloaded the certificate from my developer
I am new at php programming but I have been stuck with this code
I have been stuck with this problem for a while now. I know that
I have been stuck on this for a while now and I cannot seem
I have been stuck on this for days, and was wondering if anyone had
I have been stuck on this for a while. i have tried and I
I have been stuck on this and don't really know how to go about
I have been stuck on this silly if statement, whatever i do, I cannot

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.