Hi,
I am trying to populate the contents of maxContent of am
openInfoWindowHtml with jquery ajax response. The response (which is
JSON) would build html and bind events to some of the new html
produced.

I don't seem to be able to a:
a) pass maxContent jquery object such as $('<div>somthing</div>); (the
google map doc says this par is a string however!)

b) if I create a div with document.createElement then all good (the
elment gets greated in the maxContent) - but this does not fully
register in the dom tree (i can't access it through jquery append
function. Should this be possible?)

Below is some code which at the moment just builds a string and set it
with innerHtml. It does somthing nastly and writes out JS to bind the
event to a function. This works in FF but not, yes you've guessed it,
IE!

Any pointers would be great - it is slowing driving me mad - it should
be so simple, right?


Cheers

Jack
p.s. Sorry I have not got a public facing url at this point.
-----------------


 function creatStopMarker_(stopPoint,StopCode,MarkerType){
        var marker = new GMarker(stopPoint, {icon: icon});
        GEvent.addListener(marker, 'click', function(){
            var maxContentDiv = document.createElement('div');
            maxContentDiv.innerHTML = '<div
class="StopWindowDataTwo">Loading</div>'
            marker.openInfoWindowHtml("<div style='padding:
5px'>"+StopCode+"</div>",
            {maxContent: maxContentDiv,
            maxTitle: StopCode});

            var iw = map.getInfoWindow();
            GEvent.addListener(iw, "maximizeclick", function() {

                    $.ajax({
                    type: "GET",
                    contentType: "application/json; charset=utf-8",
                    url: "script.aspx?stopcode="+StopCode,
                    dataType: "json",
                    success: function (msg) {;


                               var  StackIt='';
                              eval(msg.d);
                                     $.each(Routes, function(i,item){
                           /* I would rather do
                           maxContentDiv.append($('.....').bind
(....);  etc here .... */

/* i no this is poor ! */
                                         StackIt += '<div
class="routeItemSet_'+item.Route+'">'+ item.Route +'</div><script>$
(\'.routeItemSet_'+item.Route+'\').bind(\'click\', function()
{stopWindow_RouteClick(\''+item.Route+'\');});</script>';

                                    });

                                    StackIt+='<div
class="stopWindowLoad">stopWindowLoad</div>';

                                  maxContentDiv.innerHTML = StackIt;

                            }
                   });
            });
        });
        return marker;
    }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" 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-api?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to