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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T18:44:08+00:00 2026-05-15T18:44:08+00:00

Ive got a problem, Im using jquery for my googlemaps thingy Im doin and

  • 0

Ive got a problem, Im using jquery for my googlemaps thingy Im doin and Im gettin a number from an php array and I´m reading from it via a for-loop and want to translate that number into a word, for example I get the number 1 in the array and then I´d like to translate that number to the word “Core-router”.

And return that word into my marker variable to display that word when I click on the marker on the map.

Here is my code Ive written so far:

    <?php echo $location; ?> // where i get the array from...

    var i, myLatLng;
    for (i = 0; i < switches.length; i++) {

        myLatLng = new GLatLng(switches[i][1], switches[i][2]);
          var marker = createTabbedMarker(myLatLng, ["Namn: "+switches[i][0]+ "<br /> Adress: "+switches[i][3]+ "<br /> Type: "+switches[i][4], "N/A","N/A"],["Information","Detaljer","Övrigt"]);
       map.addOverlay(marker, markerOptions);

    }

The code is working like a charm and as you can see on the arrayposition 4 switches[i][4]
is where I get the number from, Id like to return a word instead on that position.

The thing I thought about was to do it like this:

Write this in the forloop:

var type = switches[i][4];

        if(type == "2") {
            return("Distributionsswitch");
            }
        if(type == "3") {
            return("Accessswitch");
        }
        if(type == "1") {
            return("Core / Edge - router");
            }

And somehow return that output to where I now have the :

Type: "+switches[i][4],

Hope you guys understand what Im looking for, my head is just spinnin right now because of all stress…

Best Regards,

EIGHTYFO

  • 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-15T18:44:08+00:00Added an answer on May 15, 2026 at 6:44 pm

    I personally would use a function as so

    function getStringValue(intVal)
        {
            switch(intVal)
            {
                case 1:
                return 'Core / Edge - router';
              case 2:
                return 'Distributionsswitch';
              case 3:
                return 'Accessswitch';
              default:
                return 'UNKNOWN'
            }
        }
    

    you can then use

    var marker = createTabbedMarker(myLatLng, ["Namn: "+switches[i][0]+ "<br /> Adress: "+switches[i][3]+ "<br /> Type: "+getStringValue(switches[i][4]), "N/A","N/A"],["Information","Detaljer","Övrigt"]);
    

    I haven’t been able to test this so if you have any probs let me know!

    HTH
    OneSHOT

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

Sidebar

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.