Rails 3 javascript sql query
I have a question about querying the SQLite database in on of my Rails 3 app:
The purpose of the app is to locate the user and s开发者_JAVA百科how a bunch of nearby locations.
The locations are stored in SQLite and I use JavaScript to geolocate the user and show his current position. Now that I have the Longitude and Latitude I want to check the database for nearby locations. How do I query the database with the long/lat javascript values?
I can only think of providing the data server side as .json and iterate trough it with javascript.
Thanks in advance
You cannot access a database directly from javascript (assuming you're in a browser), so your idea of providing the data server side with json is really as good an approach as any.
(Yes this would probably be better suited as a comment, but SO won't let me yet :p)
精彩评论