Also, I guess the nerddinner project has google map integration, which you can checkout.
I blog at http://rajeshpillai.net and have a community startup http://ownabook.org/
(Don't forget to click "Mark as Answer" on the post(s) that helped you.)
Check if you have jquery referenced in your project.
I blog at http://rajeshpillai.net and have a community startup http://ownabook.org/
(Don't forget to click "Mark as Answer" on the post(s) that helped you.)
$ is a function defined in jQuery and for some reason it is not getting loaded...
Fire up your webbrowser inspector or dev tool like (firebug) or other and please verify in the network resources or similar tab whether the
jquery-1.5.1.min.js is loaded correctly.....You should see a response code of 200 OK...
I blog at http://rajeshpillai.net and have a community startup http://ownabook.org/
(Don't forget to click "Mark as Answer" on the post(s) that helped you.)
function initialize() {
var latlng = new google.maps.LatLng(51.518998, -0.10437);
var options = { zoom: 6, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP };
var map = new google.maps.Map(document.getElementById("map_canvas"), options);
}
$(function () {
initialize();
});
<script>
and the error i get is:
Microsoft JScript runtime error: The value of the property '$' is null or undefined, not a Function object
i dont get what it means, if ive got the script included
archie8
Member
428 Points
308 Posts
google maps in mvc 3
Mar 20, 2012 11:47 AM|LINK
hi everyone,
sorry i dont know if im in the right section, but im using c# and asp.net mvc 3.
i wanted to know how to implement google maps in my project.
ive tried out a few example but not had an luck so far :(
what i do want to do however is have something similar to this site:
http://www.freemaptools.com/find-uk-postcodes-inside-radius.htm
where it has the map and u can get UK post codes (zip codes) within a radius.
any help would be much appreciated, thanks :)
thinkrajesh
Participant
1356 Points
232 Posts
Re: google maps in mvc 3
Mar 20, 2012 12:27 PM|LINK
You can try a working example from here..
http://www.codeproject.com/Articles/148949/ASP-NET-MVC-3-the-Razor-View-Engine-and-Google-Map
Also, I guess the nerddinner project has google map integration, which you can checkout.
(Don't forget to click "Mark as Answer" on the post(s) that helped you.)
archie8
Member
428 Points
308 Posts
Re: google maps in mvc 3
Mar 20, 2012 02:19 PM|LINK
hi rajesh
thanks for the link, but one problem. if i copy the sample code into my project it doesnt work i kepp getting this error
"Microsoft JScript runtime error: The value of the property '$' is null or undefined, not a Function object"
on this line
$(function () { initialize(); });but, if i create a brand new project it works fine.
what can i do?
thanks
thinkrajesh
Participant
1356 Points
232 Posts
Re: google maps in mvc 3
Mar 20, 2012 02:44 PM|LINK
Check if you have jquery referenced in your project.
(Don't forget to click "Mark as Answer" on the post(s) that helped you.)
archie8
Member
428 Points
308 Posts
Re: google maps in mvc 3
Mar 20, 2012 02:51 PM|LINK
yes i have this line: <script src="@Url.Content("~/Assets/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
in _Layout.cshtml page
thanks
thinkrajesh
Participant
1356 Points
232 Posts
Re: google maps in mvc 3
Mar 20, 2012 03:00 PM|LINK
$ is a function defined in jQuery and for some reason it is not getting loaded...
Fire up your webbrowser inspector or dev tool like (firebug) or other and please verify in the network resources or similar tab whether the
jquery-1.5.1.min.js is loaded correctly.....You should see a response code of 200 OK...
(Don't forget to click "Mark as Answer" on the post(s) that helped you.)
CodeHobo
All-Star
18669 Points
2648 Posts
Re: google maps in mvc 3
Mar 20, 2012 03:31 PM|LINK
Where in the layout file is that line? Can you post the complete markup for the layout and view? Thanks
Blog | Twitter : @Hattan
Young Yang -...
All-Star
21741 Points
1825 Posts
Microsoft
Re: google maps in mvc 3
Mar 22, 2012 07:01 AM|LINK
Hi
You should put this line within <head></head> tag, please check it.
Hope this helpful
Regards
Young Yang
Feedback to us
Develop and promote your apps in Windows Store
archie8
Member
428 Points
308 Posts
Re: google maps in mvc 3
Mar 22, 2012 09:04 AM|LINK
Hi,
yes this is in the <head> tag.
thanks
archie8
Member
428 Points
308 Posts
Re: google maps in mvc 3
Mar 22, 2012 09:49 AM|LINK
this is what im using:
<script type="text/javascript">
function initialize() {
var latlng = new google.maps.LatLng(51.518998, -0.10437);
var options = { zoom: 6, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP };
var map = new google.maps.Map(document.getElementById("map_canvas"), options);
}
$(function () {
initialize();
});
<script>
and the error i get is:
Microsoft JScript runtime error: The value of the property '$' is null or undefined, not a Function object
i dont get what it means, if ive got the script included