1

Trying to perform a search by address using jquery-ui-map plug-in.

Firefox reports: TypeError: h[b] is undefined /js/ui-map/jquery.ui.map.full.min.js Line: 2

$(document).ready(function() {
        $('#map_canvas').gmap('search', { 'address': 'Stockholm' }, function(isFound,results) {
            if (isFound) {
                $('#map_canvas').gmap('getMap').panTo(results[0].geometry.location);
            }
        });
});

Please help.

EDIT: Reported to developer at http://code.google.com/p/jquery-ui-map/issues/detail?id=64

Alex G
  • 3,048
  • 10
  • 39
  • 78
  • added my error as well to the tracker. I have the same issue with findMarker. Wondering if it's not jQuery. What is your version of jQuery? – Spir Oct 18 '12 at 16:50
  • I finally fix my issue after reading @johansalllarsson remarks: `findMarker is mainly for 'search', you should use $('#m').gmap('get', 'markers')['m_1'], $('#m').gmap('get', 'markers').m_1 or $('#m').gmap('get', 'markers > m_1') that would be faster. So, $('#m').gmap('get', 'markers > m_1').tags = 'something'; would be better than using findMarker.` Here: https://groups.google.com/forum/?fromgroups=#!topic/jquery-ui-map-discuss/Dl9m7IeIxh0 – Spir Oct 19 '12 at 08:19

1 Answers1

2

instead of gmap('getMap') one should use gmap('get','map'). Besides you swapped isFound and results The correct sample is:

$(document).ready(function() {
        $('#map_canvas').gmap('search', { 'address': 'Stockholm' }, function(results,isFound) {
            if (isFound) {
                $('#map_canvas').gmap('get','map').panTo(results[0].geometry.location);
            }
        });
});
serg
  • 36
  • 2