tags:

views:

238

answers:

2

I have a testsite which loads at the push of the magnifying button .../forms/viewlab.php?sid=2 dynamically via jquery 'load' (ajax). Viewlab.php contains a with id "map" and should load/display a google map.

Strange thing is that upon push of the button ("load map"), the goggle map only loads for a split second (depending on the speed of your computer you can actually see it flicker once) and then disappears.

I am using the google ajax api to load google maps and jquery. Any any idea how to make that work?

A: 

Try not calling GUnload() until your page exits. At present you're calling GUnload() before creating the map.

I guess that GUnload() might be asynchronous, so that you manage to create the map before GUnload() finishes destroying the API code, but as soon as you return control from your map creation the rest of the GUnload() processing executes, taking down the API, erasing the map and recovering the memory used.

Mike Williams
A: 

I don't have a concrete maps example by hand, but it's rather an AJAX related issue, i assume.

the problem might be, when which events do happen and when which code gets triggered:

You might need to move some code out of the document ready function,

then you can bind the AJAX on document ready by a function call ...

... and later re-bind it by a callback function call within the form's success function.