Hi all, I am using the google maps API to perform some geolocation on the client side. I am able to geocode my users address without any issues. However after doing this on the front end I would like to goto my backend and query my DB based on the address. After that I want to redirect the users to a different page where the query results would be displayed. Is there a way to achieve this? I was doing everything on the backend before this and it was working fine. However there is limit associated with the geolocation API from Google and the limit is set per IP. Hence I wanted to perform the geolocation on the client side so that I don''t exceed the limit. Here is my controller code: def result # the location parameter comes from the geocoded address on the front end @restaurants = Restaurant.load_results(params[:location]) render :layout => ''search_results'' end But this call never gets redirected to the result.html.erb page Any help will be really appreciated. Thanks, vishy -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Your view code would be helpful to see. On Mar 21, 5:48 am, vishy <shubhambansa...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi all, > > I am using the google maps API to perform some geolocation on the > client side. I am able to geocode my users address without any issues. > However after doing this on the front end I would like to goto my > backend and query my DB based on the address. After that I want to > redirect the users to a different page where the query results would > be displayed. Is there a way to achieve this? > > I was doing everything on the backend before this and it was working > fine. However there is limit associated with the geolocation API from > Google and the limit is set per IP. Hence I wanted to perform the > geolocation on the client side so that I don''t exceed the limit. > > Here is my controller code: > > def result > # the location parameter comes from the geocoded address on the front > end > @restaurants = Restaurant.load_results(params[:location]) > render :layout => ''search_results'' > end > > But this call never gets redirected to the result.html.erb page > > Any help will be really appreciated. > > Thanks, > vishy-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
here is the view code in the result.html.erb <% restaurants.each do |restaurant| %> <div class="featured"> <%= render ''search_result'', :restaurant => restaurant%> <div class="order_link"> <%= link_to ''Order Now'', {:controller => "search", :action => "create_order", :id => restaurant}, :class => "order_now_link"%> </div> </div> <div class="clear"></div> </div> <%end%> On Mar 21, 3:25 am, Clint <simon.krollpfei...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Your view code would be helpful to see. > > On Mar 21, 5:48 am, vishy <shubhambansa...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > Hi all, > > > I am using the google maps API to perform some geolocation on the > > client side. I am able to geocode my users address without any issues. > > However after doing this on the front end I would like to goto my > > backend and query my DB based on the address. After that I want to > > redirect the users to a different page where the query results would > > be displayed. Is there a way to achieve this? > > > I was doing everything on the backend before this and it was working > > fine. However there is limit associated with the geolocation API from > > Google and the limit is set per IP. Hence I wanted to perform the > > geolocation on the client side so that I don''t exceed the limit. > > > Here is my controller code: > > > def result > > # the location parameter comes from the geocoded address on the front > > end > > @restaurants = Restaurant.load_results(params[:location]) > > render :layout => ''search_results'' > > end > > > But this call never gets redirected to the result.html.erb page > > > Any help will be really appreciated. > > > Thanks, > > vishy-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Oops hit the send button too quickly. Here is the actual result.html.erb code <% @restaurants.each do |restaurant| %> <div class="featured"> <%= render ''search_result'', :restaurant => restaurant%> <div class="order_link"> <%= link_to ''Order Now'', {:controller => "search", :action => "create_order", :id => restaurant}, :class => "order_now_link"%> </div> </div> <% end %> -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Also the JS code in my application.js is : $(''searchbutton'').live(''click'', function() { var address = $(''address_text).val(); geocoder = new google.maps.geocoder(); geocoder.geocode(request:address,callback:function(results,status) { var lat = results[0].geometry.location.lat().toString(); var lng = results[0].geometry.location.lng().toString(); $.getScript("search/result.html?location=" + address); return false; }); }); On Mar 21, 6:20 am, vishy <shubhambansa...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Oops hit the send button too quickly. > > Here is the actual result.html.erb code > > <% @restaurants.each do |restaurant| %> > <div class="featured"> > <%= render ''search_result'', :restaurant => restaurant%> > <div class="order_link"> > <%= link_to ''Order Now'', {:controller => "search", :action => > "create_order", :id => restaurant}, > :class => "order_now_link"%> > </div> > </div> > <% end %>-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Anyone?? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Are you using Firebug to see if any Javascript errors are preventing the call from even ocurring? Did you see the syntax error in your .js? $(''address_text) should be $ (''address_text'') On Mar 21, 2:17 pm, vishy <shubhambansa...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Anyone??-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.