Hi again guys!
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