Forum Moderators: open

Message Too Old, No Replies

data generated from php, on the google map and on the list

         

soladon

11:36 am on Jul 15, 2008 (gmt 0)

10+ Year Member



Hi there,
When i call the page myplaces.php the php script makes a query on the database and gets an array of my places. My places contain, id,name,X,Y.

What i want now is to show this data both on the map and on a list on the side of the map. This leaves me with the question "What is the best way to achieve that?"
The options i have come up with so far are:

A. Myplaces.php generates the html for the list on the side of the map. The associative array with the data gets encoded on a json string, which is passed via onload function to javascript, and javascript takes care of showing these places on the map. I have a little problem doing that when using jquery though cause i cant pass this string at $(document).ready() function...Or can I?

B. Myplaces.php generates just two empty divs, one for the map and one for the list. Then at onload function i make an ajax call and the response is an hml string to be put in the list div and an json string to be manipulated for the map. I could use only the json string to create the html by using javascript and DOM for the list div if i wanted...

C. Myplaces.php generates the html for the list on the side of the map. In addition myplaces.php generates the javascript code, instantiating an array of objects (as if someone hard coded it), each representing one point.

Any ideas would be appreciated!
Thanks

soladon

9:01 am on Jul 16, 2008 (gmt 0)

10+ Year Member



No opinions, anyone?

soladon

9:03 am on Jul 16, 2008 (gmt 0)

10+ Year Member



No opinions, anyone?

tomda

9:56 am on Jul 16, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Never done Google Map so I can't help you but they are tons of template/examples in the Google Map API pages, and most of them will show you how do to this using the Google Map API - especially the one loading XML.

So your PHP must generate a XML which then loading by the API