[Need advices] Geolocation + Store Locator

Hello everyone,

I was going to build a Geolocation + Store Locator and i wasn’t so sure what’s the proper way to do it. My current plan was:

  1. Create a MySQL database which contains (about 200 rows) address, lat, lng, url.
  2. Get the lat (position.coords.latitude) & lng (position.coords.longitude) of my current position via javascript

What i want to do next:
Passing the lat & lng data as an array with JQuery.ajax to php to find the nearest store within a specific radius which found from google below:

SELECT id, ( 3959 * acos( cos( radians(37) ) * cos( radians( lat ) ) * cos( radians( lng ) - radians(-122) ) + sin( radians(37) ) * sin( radians( lat ) ) ) ) AS distance FROM markers HAVING distance < 25 ORDER BY distance LIMIT 0 , 20;

and returns the value into javascript with the selected row of data and pop ups a modal box (e.g. fancybox) on the screen with a message and a links to the store URL.

Please don’t get me wrong i wasn’t asking someone to provide me a code here. I’m just wondering would someone be able to give me some tips or direction where to go. e.g. (passing array data using JSON / place array as cookies…etc)

Thank you for your attention. Really appreciate.