[Rails] Re: how to pass ruby objects to javascript ?

2009-07-24 Thread Nilesh Kulkarni
Nilesh Kulkarni wrote: > thanks for reply > function google_map(){ > for(var j=0; j < locs.length; j++) > { > marker=addMarker(locs[i]['lat'], locs[i]['lng']) > }} ooo not var locs = (#...@locations.to_json}); but locs = (#{locations.to_json}); -- Posted via http://www.ruby-forum

[Rails] Re: how to pass ruby objects to javascript ?

2009-07-24 Thread Nilesh Kulkarni
Wayne Simacek wrote: > Are you using the GeoKit Rails plugin? > > On Jul 23, 3:52�am, Max Williams no... -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails:

[Rails] Re: how to pass ruby objects to javascript ?

2009-07-24 Thread Nilesh Kulkarni
thanks for reply I have done it something like = render :partial => 'coupons/search', :locals => {:locations => business_locations.} in "_search.html.haml" :javascript var locs = (#...@locations.to_json}); function google_map(){ for(var j=0; j < locs.length; j++) { marker=addMarker(locs

[Rails] Re: how to pass ruby objects to javascript ?

2009-07-24 Thread Frederick Cheung
On Jul 23, 9:52 am, Max Williams wrote: > vlain wrote: > > Wrap variables around <%= %> inside double quote > > e.g. > > for(var j=0; j < "<%=locations.length%>"; j++) > > > On Jul 22, 4:17 pm, Nilesh Kulkarni > > As a slightly more general solution, rather than wrapping the "" around > the er

[Rails] Re: how to pass ruby objects to javascript ?

2009-07-24 Thread Wayne Simacek
Are you using the GeoKit Rails plugin? On Jul 23, 3:52 am, Max Williams wrote: > vlain wrote: > > Wrap variables around <%= %> inside double quote > > e.g. > > for(var j=0; j < "<%=locations.length%>"; j++) > > > On Jul 22, 4:17 pm, Nilesh Kulkarni > > As a slightly more general solution, rathe

[Rails] Re: how to pass ruby objects to javascript ?

2009-07-23 Thread Max Williams
vlain wrote: > Wrap variables around <%= %> inside double quote > e.g. > for(var j=0; j < "<%=locations.length%>"; j++) > > > > On Jul 22, 4:17�pm, Nilesh Kulkarni As a slightly more general solution, rather than wrapping the "" around the erb block, if you call inspect on the object inside

[Rails] Re: how to pass ruby objects to javascript ?

2009-07-23 Thread vlain
Wrap variables around <%= %> inside double quote e.g. for(var j=0; j < "<%=locations.length%>"; j++) On Jul 22, 4:17 pm, Nilesh Kulkarni wrote: > hi all, > >    I have following problem, > >    I am using google map api , I have  "business_locations" array > defined in view it contains latitud