Mistyped: But when it's looped in JS file it gave wrong value. Empty variables.
On 10 Грд, 17:33, Futsutsuka <[email protected]> wrote: > well I wrote an array of names - var cities = new > Array(kiev,kharkov,lvov,odessa); > But when it's looped in JS file . As the cities to view in JS file are > variables that are set in JS file. And the sequence I believe now is > following: > 1. The php loads gmap_loop.js > 2. gmap_loop.js sets variables with markers and map. > 3. php writes array that contains names of the variables to be set in > var cities in gmap_loop.js (which is already set). > 4. map is loaded. > > what if I change the sequence to: > 1. php writes to browser a JS function loadArray() that generates an > array with cities. > 2. php loads gmap_loop.js. > 3. gmap_loop.js sets variables with markers calls function loadArray > that returns array cities and loads map > > Will it work? > > On 10 Грд, 16:56, Rossko <[email protected]> wrote: > > > > > > > > > > Than the question is... how to tell to array cities in gmap_loop.js > > > that it should collect only those variable that are equal to names of > > > cities defined in PHP array $clean_cities? > > > I think you want to load a whole set of cities in your javascript > > file, but only display some of them according to some selection values > > passed from php?? > > > You might write an array of names or some other ID into your main > > page, then have your javascript loop through your possibles and > > display ones that match. > > Or you might pass names or some other ID via the page URL querystring, > > and so not modify the page every time (allowing user's browsers to use > > their cache effectively). -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.
