Hi,
I'm trying to integrate Google maps API V3 into my Rhodes app. I have
good experience with Google Maps V3 as I created a desktop website and
a jQuery Mobile Website with it. However, I just can't get it to work.
I use the iPhone Simulator to test. In the JS code below, the code
crashes between the alert("Test3"); and alert("Test4");
I call the Google Maps V3 API this way in the head section of
layout.erb:
<script type="text/javascript" src="
http://maps.google.com/maps/
api/js?sensor=true"></script>
<script src="/public/js/application.js" type="text/javascript"></
script>
JS code in application.js (included in layout.erb):
function initialize() {
alert("Test");
var latlng = new google.maps.LatLng(-34.397, 150.644);
alert("Test2");
var myOptions = {
zoom: 8,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
alert("Test3");
var map = new
google.maps.Map(document.getElementById("map_canvas"), myOptions);
alert("Test4");
}
View code:
<div class="pageTitle">
<h1>Map Test</h1>
</div>
<div class="toolbar">
<div class="leftItem backButton">
<a href="<%= url_for :action => :index %>">Back</a>
</div>
</div>
<div class="content">
<div id="map_canvas" style="width: 100%; height: 100%; padding: 0;"></
div>
</div>
Controller code:
def view
WebView.execute_js("initialize();")
end
Again, the code crashes after the alert("Test3");. I don't get any
error messages, rhodes just open the page and shows a popup for Test,
Test2 and Test3.
Is there an example anywhere on how to use Google Maps V3 with Rhodes.
There gotta be a quirk I'm missing somewhere.