Map is not loading in my popup window. view/test.php file
<script type="text/javascript">
$(document).ready(function() {
$(".popup_property").click(function(e){ //on add input button click
var id = $(this).attr('href');
$.post( "<?php echo base_url()?>admin/host/viewproperty/"+id , function( data ) {
$( ".popupview1" ).html( data );
});
});
});
</script>
Controller file:
host.php controller file function viewProperty
function viewProperty()
{
.....
$hostPreviewHtml = '<div id="map" class="pagescroll col-xs-12 row">
<div style="height: 250px;
" id="mapview"></div>
</div>
</div></div>
</div>
<script type="text/javascript">
var map;
var marker;
var myLatlng = new google.maps.LatLng(36.708006,-119.5559652)
var geocoder = new google.maps.Geocoder();
var infowindow = new google.maps.InfoWindow();
function initialize(){
var mapOptions = {
zoom: 18,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById("mapview"), mapOptions);
marker = new google.maps.Marker({
map: map,
position: myLatlng,
draggable: true
});
}
google.maps.event.addDomListener(window, "load", initialize);
</script>
';
echo $hostPreviewHtml;
}
No console error . but map is not loading in popup window. please help me to solve this problem.
It looks like you didn't set the Maps JS script source.
You can check out the Getting Started page of the Maps JS API and see if there are other items still missing from your implementation.
Happy coding!