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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T10:27:59+00:00 2026-06-07T10:27:59+00:00

We have a dynamic json feed that is parsed into markers on our google

  • 0

We have a dynamic json feed that is parsed into markers on our google map.

the parsing function looks something like this:

function parse_json(json) {

      // alert('start parse: '+json.length);
      if (json.length > 0) { 
        var markers = [];
        for (i=0; i<json.length; i++) {
          var report = json[i];
          //alert(report.longitude +','+report.latitude);
          // addLocation(report); 
          markers[i] = new google.maps.Marker({
            map: map,
            position: new google.maps.LatLng(report.latitude, report.longitude),
            pop_title: report.area1.name,
            pop_body: '<b><a href="/spot/'+ report.spot.slug +'">'+ report.spot.name +'</a></b>'+
                      '<br>'+ report.report_description,
            draggable: false,
            title: 'title',
            zIndex: i,
            icon: '/images/map_icon.png'
          });
          markers[i].metadata = {type: "point", id: report.id};

          google.maps.event.addListener(markers[i], 'click', onMarkerClick);

      }
    };

i have added metadata info to the markers created so their id is the report.id – but i want to use the google.maps.event.trigger(SOMETHING_HERE, 'click'); construct to trigger a click event on a given marker when a button outside of the map is pressed. how do i get the object name, or is there a way to do this using the object’s id?

thanks!

  • 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-07T10:28:02+00:00Added an answer on June 7, 2026 at 10:28 am

    If you declare your markers array at a higher scope than your parse_json function, then you will be able to refer to it later, something like this:

    var markers = new Array();
    function parse_json(json) {
        //code removed for brevity
    }
    

    Then later, when you need to find the marker you want to fire a click event against, you could use the id like this:

    for ( var i = 0; i < markers.length; i++ ) {
        var mkr = markers[i];
        if ( mkr.metadata.id === idYouAreSearchingFor ) {
            //do whatever is needed here and fire your event
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have JSON string that has nested objects with dynamic names that vary each
I have some divs that have dynamic heights controlled by a 'click' function as
I have some divs that have dynamic heights controlled by a 'click' function as
I have dynamic json result and i want to create an object for that
I am using google gson-2.2.1 library for parsing large response of JSON. I have
I have a dynamic json data having the format var cols= { columns :
I have dynamic listview on my android client app that receive data from remote
I have a dynamic tableview which has a prototype cell with a button that,
I have a structure for a notification system that I believe is pretty dynamic,
I have a Logging Entity that needs to map an Entity that is a

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.