I'm trying to create a module that will make use of Google Maps to display the current places indicated in the search results via markers. The problem that I'm having is that I'm getting the following error when I add the Google maps script:
Uncaught ReferenceError: jQuery is not defined
The map wouldn't work if I don't include my own version of jQuery, but the error stays there whether or not I include jQuery.
function gmapsnrew_block_view($delta = ''){
$block['subject'] = 'Google Map Test';
$block['content'] = '<div id="map-canvas"></div>';
return $block;
}
drupal_add_css(drupal_get_path('module', 'gmapsnrew') . '/css/gmapsnrew.css');
drupal_add_js('http://maps.googleapis.com/maps/api/js?key=google_key&sensor=false&libraries=places');
drupal_add_js(drupal_get_path('module', 'gmapsnrew') . '/js/load-map.js');
And the load-map.js
looks something like this:
(function ($) {
Drupal.behaviors.gmapsnrew = {
attach: function(context, settings){
console.log(context);
var base_lat = 51.322377;
var base_lng = -0.1358427;
var latlng = new google.maps.LatLng(base_lat, base_lng);
var options = {
zoom: 10,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP,
mapTypeControl: false
};
var map = new google.maps.Map(document.getElementById("map-canvas"), options);
}
}
})(jQuery);
Any ideas what I'm doing wrong here? Thanks in advance.