I am getting back a dataset from an AJAX webservice and I want to pass it into a function that creates markers on google maps. Here is an example of what I've got:
//setting up webservice
var mapPnts = new DoAJAXns.DoAJAX();
//sending in a key to pull data from webservice returns marker information which I call locations
mapPnts.getMapPnts(SearchInfo.key, function setMarkers(locations) {
//appending the markers
for (var i = 0; i < d.SearchEvents.length; i++) {
var image = new google.maps.MarkerImage('Images/markers/' + d.SearchEvents[i].EventCategory + '.png')
var myLatLng = new google.maps.LatLng(d.SearchEvents[i].VenueLatitude, d.SearchEvents[i].VenueLongitude);
var marker = new google.maps.Marker({
position: myLatLng,
map: map,
icon: image,
title: (d.SearchEvents[i].EventTitle + '<br>' +
My problem here is how do I pass the map variable in since it is apart of the webservice? If there is a better way of doing this please let me know.
Schwimms
Member
100 Points
327 Posts
Help with passing dataset to Javascript and Google maps
Jan 19, 2013 06:53 AM|LINK
Hi All!
I am getting back a dataset from an AJAX webservice and I want to pass it into a function that creates markers on google maps. Here is an example of what I've got:
//setting up webservice var mapPnts = new DoAJAXns.DoAJAX(); //sending in a key to pull data from webservice returns marker information which I call locations mapPnts.getMapPnts(SearchInfo.key, function setMarkers(locations) { //appending the markers for (var i = 0; i < d.SearchEvents.length; i++) { var image = new google.maps.MarkerImage('Images/markers/' + d.SearchEvents[i].EventCategory + '.png') var myLatLng = new google.maps.LatLng(d.SearchEvents[i].VenueLatitude, d.SearchEvents[i].VenueLongitude); var marker = new google.maps.Marker({ position: myLatLng, map: map, icon: image, title: (d.SearchEvents[i].EventTitle + '<br>' +My problem here is how do I pass the map variable in since it is apart of the webservice? If there is a better way of doing this please let me know.
Song-Tian - ...
All-Star
43705 Points
4304 Posts
Microsoft
Re: Help with passing dataset to Javascript and Google maps
Jan 24, 2013 10:08 AM|LINK
Hi,
You can use jquery ajax or call web service in asp.net page directly.
#Calling Web Services from Client Script
http://msdn.microsoft.com/en-us/library/bb398995(v=VS.90).aspx
#jQuery.ajax()
http://api.jquery.com/jQuery.ajax/
Feedback to us
Develop and promote your apps in Windows Store