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 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

Ask A Question

Stats

  • Questions 535k
  • Answers 535k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You need to put your code in a method You… May 17, 2026 at 1:01 am
  • Editorial Team
    Editorial Team added an answer This is what I've found: the timer, even at fast… May 17, 2026 at 1:01 am
  • Editorial Team
    Editorial Team added an answer The underlying value of both of those enums is int.… May 17, 2026 at 1:01 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I've got a problem where I generated a Quicktime plgin using the AC_Quicktime plugin,
So, I've got a problem using style=overflow:auto; on IE6 / 7 browsers. It just
I've got a problem when i using UI Tabs and load an external page
I've got a form that is using jQuery validation. When the user clicks the
I've got this textBox which triggers off an ajax request using jQuery: <asp:TextBox ID=postcodeTextBox
I've got a UL of items using jQuery UI that I have drag and
I've got a jQuery function that's posting to the server using $.ajax and it
I've got a bit of a problem, I'm using a backgroundworker to do a
I'm having trouble loading JQueryUI from Google's CDN. I've got an ASP.NET application that
I've got a little problem: I don't know whether it is possible to select

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.