am trying to load google map by passing city name or address.
1 ) Map not displaying 2 ) How to load google map passing address or city name 3 ) How to load different location on mouse-over() that pass dynamic address
<script src="~/Scripts/jquery-2.1.4.min.js"></script> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> <script type="text/javascript"> function codeAddress(address) { geocoder = new google.maps.Geocoder(); geocoder.geocode({ 'address': address }, function (results, status) { if (status == google.maps.GeocoderStatus.OK) { var myOptions = { zoom: 8, center: results[0].geometry.location, mapTypeId: google.maps.MapTypeId.ROADMAP } map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); var marker = new google.maps.Marker({ map: map, position: results[0].geometry.location }); } }); } </script> <script type="text/javascript"> $(".tiptext").mouseover(function () { // debugger; $(this).children(".description").show(); codeAddress(address); }).mouseout(function () { $(this).children(".description").hide(); }); </script>
CSS: #map-canvas { width: 50%; height: 50%; margin: 0; padding:0px; } View: <div id="map_canvas"> <div id="address"> @item.address @item.city </div> </div>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)