Note that there are some explanatory texts on larger screens.

plurals
  1. POJQUERY-UI-MAP "Uncaught TypeError: Object [object Object] has no method 'gmap' "
    text
    copied!<p>I'm using jquery-ui-map 3.0 RC to simplify the process of using json to place markers on a google map using javascript api v3. </p> <p>When I prototyped using html files it worked fine. Once I started to use embed code within an MVC4 project and debug using iis express I'd get an error in Google Chrome Developer Tools "Uncaught TypeError: Object [object Object] has no method 'gmap'.</p> <pre><code>&lt;script type="text/javascript" src="http://maps.google.com/maps/api/js?key=MYBROWSERAPIKEYISHERE&amp;sensor=true"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="../../Scripts/jquery.ui.map.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="../../Scripts/gmap3.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function () { initialize(); }); function getMarkers() { // This URL won't work on your localhost, so you need to change it // see http://en.wikipedia.org/wiki/Same_origin_policy $.getJSON('../../Data/Australia-WA-Perth.json', function (data) { $.each(data.markers, function (i, marker) { $('#map_canvas').gmap('addMarker', { 'position': new google.maps.LatLng(marker.latitude, marker.longitude), 'bounds': true }).click(function () { $('#map_canvas').gmap('openInfoWindow', { 'content': marker.content }, this); }); }); }); } function initialize() { var pointCenter = new google.maps.LatLng(-31.95236980, 115.8571791); var myMapOptions = { zoom: 17, center: pointCenter, mapTypeId: google.maps.MapTypeId.ROADMAP //TERRAIN }; var map = new google.maps.Map(document.getElementById("map_canvas"), myMapOptions); google.maps.event.addListenerOnce(map, 'idle', function () { getMarkers(); }); } &lt;/script&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload