Hi Shiva,
There isn't an API based command to do this. You have to write it
yourself, but it If your points are not to spread out you can use a
simple Pythagorean distance calculation. The distance you want is the
hypoteneuse of a right triangle; each end of the hypoteneuse is one of
two points to be measured (one of these is the point the user clicks,
and the other is a point from your database; do the calculation in a
loop). So, the square root of (latitude distance squared plus
longitude distance squared) is the distance between the points. Store
the results in an array, sort the array when the loop finishes, and
send the top n results back via your Ajax call, then draw the points
with a different symbol. If the points in your database cover a wide
geographic area, you might consider doing this with a Haversine
distance calculation, but since you're only looking for relative
distances, not absolute, you can probably get by with simply plane
geometry, so the Pythagorean distance will suffice.
-Steve