hi all,

   I have following problem,


   I am using google map api , I have  "business_locations" array
defined in view it contains latitude and longitude in following format
lng-142.122745lat42.674224
lng-112.122745lat46.674224
lng-122.122745lat40.674224

I am sending locations array to partial view following way
= render :partial => 'coupons/search', :locals => {:locations =>
business_locations}

to the javascript present on "_search.html.haml" here(in javascript) i
have function google_map() and addMarker() which adds no of markers
equal to length of array so i am doing

function google_map(){
for(var j=0; j < "#{locations.length}"; j++)
  {
 marker=addMarker(parseFloat("#locations[j][:lat]"),
parseFloat("#locations[j][:lng]"));
  }}


Here j variable is not set. How I set "j" variable????????


function addMarker(latitude, longitude) {
  var marker = new GMarker(new GLatLng(latitude, longitude));
}

where ("#{locations[0]}") is  lng-142.122745lat42.674224
where ("#{locations[1]}") is  lng-112.122745lat46.674224
where ("#{locations[2]}") is  lng-112.122745lat46.674224
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to