user1085536
user1085536

Reputation:

Jquery dialog issue with map

 $("#body_content").dialog({
            title: "AAAa",
            modal: true,
            width:'auto',
            height:'auto',
            resizable:false,

            open: function(){

                var id = $('#right_button').attr('id');
                var lat = $('#right_button').attr('lat');
                var lng = $('#right_button').attr('lng');
                var body_text = $('#body_content').attr('body_text');


                $("#body_content").html(body_text); //this is the line that "breaks" the script
                if (lat != "" && lng!=""){

                if (map == null) {
                    var myOptions = {
                        zoom: 14,
                        center: new google.maps.LatLng(lat, lng),
                        mapTypeId: google.maps.MapTypeId.ROADMAP
                    };
                    var latLng = new google.maps.LatLng(lat,lng);
                    map = new google.maps.Map(document.getElementById('map_dialog'), myOptions);

                    var marker;
                    marker = new google.maps.Marker({
                        position: latLng,
                        map: map
                    });
                }


            }
                else {
                    $('#map_dialog').hide();
                }
                }

In my code I am trying show content and map into dialog, but when I use $("#body_content").html(body_text); the map donesn't appear, so when I remove this line, the map apears what is the problem here

Upvotes: 1

Views: 167

Answers (1)

matghazaryan
matghazaryan

Reputation: 5896

I think you have to look your div in your html and maybe this can help you how to set content on Jquery dialog

Upvotes: 1

Related Questions