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

  • Home
  • SEARCH
  • 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 6844337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:21:51+00:00 2026-05-27T00:21:51+00:00

I am having trouble rendering a google map infowindow anchored with multiple markers. I

  • 0

I am having trouble rendering a google map infowindow anchored with multiple markers.

I am using MVC 3 and javascript to render the map, the map renders fine, as well as relative info windows. But I want the info window to be displayed at the bottom of the map, rather than relative to the marker. The starting point for each map could be different based on the country used for search. My javascript is below (which is working)> i just don’t know how to change the infowindow:

   function initializeMap() {

var countryID = $("#CountryID :selected").val();
var cityID = $("#cities :selected").val();
var regionID = $("#regions :selected").val();
var locationtypeID = $("#LocationTypeID :selected").val();
var filtertype = $("#filtertype").val();
var latlng;

$.ajax({
    type: "GET",
    url: "/ajaxcalls/getCentre",
    data: "cid=" + countryID,
    datatype: "json",
    success: function (result) {
        var gpscoords = (result).split(",");
        latlng = new google.maps.LatLng(gpscoords[0], gpscoords[1]);
    },
    error: function (req, status, error) {            
    }
});

var myOptions = {
    zoom: 7,
    center: latlng,
    mapTypeId: google.maps.MapTypeId.ROADMAP
};    

var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

$.ajax({
    type: "GET",
    url: "/ajaxcalls/getmarkers",
    data: "cid=" + countryID + "&rid=" + regionID + "&xid=" + cityID + "&tid=" + locationtypeID + "&filterType=" + filtertype,
    datatype: "json",
    success: function (result) {

        var infowindow = null;

        infowindow = new google.maps.InfoWindow({
            content: "holding..."
        });

        $.each(result, function (i, item) {

            var gpscoords = (item.GPSCoOrds.toString()).split(",");

            var mpos = new google.maps.LatLng(gpscoords[1], gpscoords[0]);

            var markerobject = "";

            if (item.LocationTypeID == 2) {
                markerobject = "atm.png";
            }
            else {
                markerobject = "bank.png";
            }

            marker = new google.maps.Marker({
                map: map,
                position: mpos,
                draggable: false,
                icon: "/content/mapicons/" + markerobject,
                title: item.Designation.toString() + " " + item.Address.toString()
            });

            google.maps.event.addListener(marker, 'mouseover', function () {
                var windowcontent = "<div>Site Name: ";
                windowcontent = windowcontent + item.Designation + "</div>";
                windowcontent = windowcontent + "<div>Address: " + item.Address + "</div>";
                windowcontent = windowcontent + "<div>Contact Number: " + item.contactNumber + "</div>";
                windowcontent = windowcontent + "<div>Branch Type: " + item.BranchType + "</div>";
                windowcontent = windowcontent + "<div>Network Provider: " + item.NetworkProvider + "</div>";
                windowcontent = windowcontent + "<div>Network Capacity: " + item.NetworkCapacity + "</div>";

                infowindow.setContent(windowcontent);

                infowindow.open(map, this);
            });
        });
    },
    error: function (req, stats, error) {
        alert(error);
    }
});
    }

   $(document).ready(function () {
        $("#mapupdater").click(function () {
    initializeMap();
});
    });

Any help would be appreciated.

  • 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-05-27T00:21:52+00:00Added an answer on May 27, 2026 at 12:21 am

    Don’t anchor the infowindow to the marker with infowindow.open(map, this);

    Just do infowindow.open(map);

    However you’ll still have to tell the infowindow where to appear. Either use the position attribute when creating it, or setPosition() after it’s been created.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having trouble using the link_to_remote method while rendering a layout. For example
I'm having trouble rendering my form's fields with WTForms. I'm using it with the
I am having a constant trouble with pages not rendering correctly between FF and
Having trouble linking the Stomp.framework into an iPhone SDK application. http://code.google.com/p/stompframework/ I follow the
Im having trouble using a .NET COM in vb6, It compiles ok and I
I having trouble in dividing the HTML frames. I have been using the following
I recently switched to Google closure for a new project. I am having trouble
I'm building an application in ruby using the sinatra framework and am having trouble
I am having more trouble with rendering 3d objects in java, heres my new
I'm a Scala/Lift beginner and I'm having trouble with rendering a list with optional

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.