/ Published in: JavaScript

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$('#idPage').live('pagecreate', function(event, ui) { option = { zoom: 16, mapTypeId: google.maps.MapTypeId.ROADMAP }; map = new google.maps.Map(document.getElementById("map_canvas"), option); }); $('#idPage').live('pageshow', function(event, ui) { var dataCoords; $.ajax({ type: 'GET', async: false, url: './_ajax/coordsMap.php', data: 'qCoords=1', success: function(msg) { dataCoords = jQuery.parseJSON(msg); }, error: function(msg) { alert('error qCoords'); } }); latlng = new google.maps.LatLng(dataCoords.lat, dataCoords.lon); map.setCenter(latlng); var marker = new google.maps.Marker({ position: latlng, map: map, }); google.maps.event.trigger(map, 'resize'); map.setOptions(option); });
Comments
