I'm preventing a link_to
when I click on it with the ev.preventDefault();
inside the function below... the javascript function gets executed but after that I want the original link_to thats was clicked to be executed.
<% @categories.each do |category| %>
<%= link_to "#{category.name}", search_path(:search => category.id), :onclick=>'getLocation(event);' %>
<% end %>
function getLocation(ev) {
ev.preventDefault();
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(setGeoCookie,showError);
} else {
alert("Geolocation is not supported by this browser.");
}
}
I'm not sure that this is possible, but if you can think of another way to implement this, it would be very helpful.