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 7571953
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T15:47:56+00:00 2026-05-30T15:47:56+00:00

I have jquery mobile site, trying to add a gmap (v3) with dynamic markers:

  • 0

I have jquery mobile site, trying to add a gmap (v3) with dynamic markers:

 bindMap: function () {

    var markers = mapArray;  //global var with coordinates

    $('#mapContent').gmap({ 'callback': function () {
        var self = this;           
        $.each(markers, function (i, m) {
            if (markers[i][0] && markers[i][1]) {

                self.addMarker({ 'position': new google.maps.LatLng(markers[i][0], markers[i][1]), 'bounds': true }).click(function () {
                    self.openInfoWindow({ 'content': markers[i][2] }, this);
                });
            }
        });
    }
    });

} 

It loads me a map with markers, but once I change markers and go back to the same code to display this map, it skips the call back function and does not render a fresh map with new markers. I tried to call $('#mapContent').gmap('refresh') before or $('#mapContent').gmap('clear', 'markers'), still doesnt display new markers..

  • 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-30T15:47:57+00:00Added an answer on May 30, 2026 at 3:47 pm

    Im not too sure what you mean ‘go back to the same code’ but cant you reuse the same map object.

    I would have a method that creates the map and a method that adds/refreshes markers

    function addMarkers(markers, clearOld) {
    
       if(clearOld) $('#mapContent').gmap('clear', 'markers');
    
       $.each(markers, function(i, m) {
          $('#mapContent').gmap('addMarker', {
             'position': new google.maps.LatLng(m.lat, m.lng),
             'bounds':true,
             'id' : m.id,
             'icon' : 'img/marker.png'
         },function(map,marker) {
             $(marker).click(function(){
               //do something
             });
         });
       });
    

    }

    So just reuse the map and call addMarkers when you want to add new markers to the map

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

Sidebar

Related Questions

I am trying to add a list view to a jQuery mobile site after
I have simple jQuery Mobile site created using asp.net mvc 2 and uses basic
I have created a mobile version of my website using jquery mobile. My site
I'm working on a mobile view of our site. I'm trying to implement JQuery
I have created a small app having navigation UI similar to jQuery Mobile site.
i have created a mobile site with jquery mobile to go into a phonegap
I have developed a jquery mobile application for my site http://tastykhana.in/m there is an
I've posted similar question but no response. I have a jQuery Mobile site and
I have a form on my jQuery Mobile site that I would like to
I am currently developing a mobile site using jQuery mobile. I have one simple

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.