Click here to Skip to main content
16,004,529 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a separate .js page with this code


C#
var map;
$(document).ready(function () {
    InitializeMap();
});


function InitializeMap() {
    var latlng = new google.maps.LatLng(-33.956009, 25.601481);
    var myOptions = {
        zoom: 15,
        center: latlng,
        mapTypeControl: true,
        mapTypeControlOptions: { style: google.maps.MapTypeControlStyle.DROPDOWN_MENU },
        navigationControl: true,
        navigationControlOptions: { style: google.maps.NavigationControlStyle.SMALL },
        mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    map = new google.maps.Map(document.getElementById("map"), myOptions);
}
window.onload = InitializeMap;
var bikeLayer = new google.maps.InfoWindow();
bikeLayer.setMap(map);


var companyPos = new google.maps.LatLng(-33.956009, 25.601481);

var companyMarker = new google.maps.Marker({
    position: companyPos,
    map: map,

    title: "Erica",
    zIndex: 3
});

google.maps.event.addListener(companyMarker, 'click', function () {
    bikeLayer.open(map, companyMarker);
});


i get the error whn running my page
JavaScript
"Uncaught ReferenceError: $ is not defined "
in this line
JavaScript
$(document).ready(function () {
Posted

1 solution

That means you have not referenced the jQuery file in your Web Page.

Please include that in your page, where you are also using this external js file.
 
Share this answer
 
Comments
Karthik_Mahalingam 29-Nov-13 2:49am    
yes, you r right..
Thanks. :)
Anele Ngqandu 29-Nov-13 3:13am    
hehe...stress Gents stress, thanx
:D Most Welcome. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900